Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJiAg-0000no-UV for pgsql-hackers@arkaria.postgresql.org; Sun, 13 Oct 2019 18:00:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iJdY6-0004Ut-NF for pgsql-hackers@arkaria.postgresql.org; Sun, 13 Oct 2019 13:04:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJdX2-0004US-E4 for pgsql-hackers@lists.postgresql.org; Sun, 13 Oct 2019 13:03:32 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iJdWu-0002HU-TE for pgsql-hackers@lists.postgresql.org; Sun, 13 Oct 2019 13:03:30 +0000 Received: by mail-io1-xd41.google.com with SMTP id n26so31340988ioj.8 for ; Sun, 13 Oct 2019 06:03:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=F3cT21tBiq9DaBC1CrEP5Q7Z+O/tOLgtNwk2XhD8sIY=; b=DYuaD1ZgecE4+pdA1S6TDkxO0lv0Gz2iXo77WpD91aWUfCyf54gmhHYhIGqGuhhOWI ZjGegZVYhPGy7wtCl2H1a6cTU8Y1Ig1sRR5GFe0DqTpNolcUz+3edvIaAlyqswS6aR3E WVlsSIVma/S8tOU24wW7+QI3yRamhSYMoLAOuyGeFVb1pNlG2Aej20PYXj2uwKp4TJzY Y7HS668ckN5xx/6MXASwWdKbWtkw1pCzU5ZB3UEQAd3ol/8SkNJ2czk5TFjYmaqjkD2M ZLRikDZZCcPmZvvG9ldWGP+C85XIPBmH+LU7QPK7Jgmtuk8KGIy/chkqi9Skbynt5O6N dbgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=F3cT21tBiq9DaBC1CrEP5Q7Z+O/tOLgtNwk2XhD8sIY=; b=Wx9yiqWKbxAZePQnUDLN2SnY4oQspLtHEKO0VgNti2+D9nXAZMhcn+BZwTifnh0fkE r6dyv5+J0GlGxp+qKSThoGD23L0SZt7XIN5yda0dDfNMr4tZAuISJq8b+jXmWaStHswG 445u7iCuLLtDUu5JWIWu01eDFh9ieAgZ/c221eGiqwHIn+LuiLapJhY48gUwBIz0hCKX wYExn2grH1OMssooPbe92h5I5a2bCXP4ZQTqDK9E7Llt82rkISSZBh9851zPsLngvJH7 2D+Ryd8rQjjtkVHObf3KilY4s0nPnZGq1zpWcORORvlgMuAtgaTNdzjETdtXGp2qvsuK XcQA== X-Gm-Message-State: APjAAAWYEaMgXMpi3y0BL8izKrrDBZc3OJpGGjI0RHieOgb5UNhWzA5t c9n4MYOoSlWLSs8VZJkzWMov4g== X-Google-Smtp-Source: APXvYqxFX/a9zPcuyBwVpt+WNQ6LQfgY8eECTFmAAtvINWYjw3vr0+BpA+GFsMf6i9oCnkNIHcHoAg== X-Received: by 2002:a6b:5404:: with SMTP id i4mr21176789iob.204.1570971804045; Sun, 13 Oct 2019 06:03:24 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id 26sm13176962iog.10.2019.10.13.06.03.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Oct 2019 06:03:23 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id CDBEF8011CB; Sun, 13 Oct 2019 08:03:21 -0500 (CDT) Date: Sun, 13 Oct 2019 08:03:21 -0500 From: Justin Pryzby To: Michael Paquier Cc: pgsql-hackers@lists.postgresql.org, Peter Eisentraut , Andreas Karlsson , Alvaro Herrera Subject: Re: v12.0: segfault in reindex CONCURRENTLY Message-ID: <20191013130321.GD4475@telsasoft.com> References: <20191012004446.GT10470@telsasoft.com> <20191013090643.GA1434@paquier.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191013090643.GA1434@paquier.xyz> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Oct 13, 2019 at 06:06:43PM +0900, Michael Paquier wrote: > On Fri, Oct 11, 2019 at 07:44:46PM -0500, Justin Pryzby wrote: > > Unfortunately, there was no core file, and I'm still trying to reproduce it. > > Forgot to set ulimit -c? Having a backtrace would surely help. Fortunately (?) another server hit crashed last night. (Doesn't appear to be relevant, but this table has no inheritence/partition-ness). Looks like it's a race condition and dereferencing *holder=NULL. The first crash was probably the same bug, due to report query running during "reindex CONCURRENTLY", and probably finished at nearly the same time as another locker. Relevant code introduced here: commit ab0dfc961b6a821f23d9c40c723d11380ce195a6 Author: Alvaro Herrera Date: Tue Apr 2 15:18:08 2019 -0300 Report progress of CREATE INDEX operations Needs to be conditionalized (as anticipated by the comment) + if (holder) pgstat_progress_update_param(PROGRESS_WAITFOR_CURRENT_PID, holder->pid); Core was generated by `postgres: postgres ts [local] REINDEX '. Program terminated with signal 11, Segmentation fault. #0 WaitForLockersMultiple (locktags=locktags@entry=0x1d30548, lockmode=lockmode@entry=5, progress=progress@entry=true) at lmgr.c:911 #1 0x00000000005c2ac8 in ReindexRelationConcurrently (relationOid=relationOid@entry=17618, options=options@entry=0) at indexcmds.c:3090 #2 0x00000000005c328a in ReindexIndex (indexRelation=, options=0, concurrent=) at indexcmds.c:2352 #3 0x00000000007657fe in standard_ProcessUtility (pstmt=pstmt@entry=0x1d05468, queryString=queryString@entry=0x1d046e0 "REINDEX INDEX CONCURRENTLY loaded_cdr_files_filename", context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=params@entry=0x0, queryEnv=queryEnv@entry=0x0, dest=dest@entry=0x1d05548, completionTag=completionTag@entry=0x7ffc05e6c0a0 "") at utility.c:787 #4 0x00007f21517204ef in pgss_ProcessUtility (pstmt=0x1d05468, queryString=0x1d046e0 "REINDEX INDEX CONCURRENTLY loaded_cdr_files_filename", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x1d05548, completionTag=0x7ffc05e6c0a0 "") at pg_stat_statements.c:1006 #5 0x0000000000762816 in PortalRunUtility (portal=0x1d7a4e0, pstmt=0x1d05468, isTopLevel=, setHoldSnapshot=, dest=0x1d05548, completionTag=0x7ffc05e6c0a0 "") at pquery.c:1175 #6 0x0000000000763267 in PortalRunMulti (portal=portal@entry=0x1d7a4e0, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=dest@entry=0x1d05548, altdest=altdest@entry=0x1d05548, completionTag=completionTag@entry=0x7ffc05e6c0a0 "") at pquery.c:1328 #7 0x0000000000763e45 in PortalRun (portal=, count=9223372036854775807, isTopLevel=, run_once=, dest=0x1d05548, altdest=0x1d05548, completionTag=0x7ffc05e6c0a0 "") at pquery.c:796 #8 0x000000000075ff45 in exec_simple_query (query_string=) at postgres.c:1215 #9 0x0000000000761212 in PostgresMain (argc=, argv=, dbname=, username=) at postgres.c:4236 #10 0x0000000000483d02 in BackendRun (port=, port=) at postmaster.c:4431 #11 BackendStartup (port=0x1d2b340) at postmaster.c:4122 #12 ServerLoop () at postmaster.c:1704 #13 0x00000000006f0b1f in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0x1cff280) at postmaster.c:1377 #14 0x0000000000484c93 in main (argc=3, argv=0x1cff280) at main.c:228 bt f #0 WaitForLockersMultiple (locktags=locktags@entry=0x1d30548, lockmode=lockmode@entry=5, progress=progress@entry=true) at lmgr.c:911 holder = 0x0 lockholders = 0x1d9b778 holders = lc = 0x1d9bf80 total = done = 1 #1 0x00000000005c2ac8 in ReindexRelationConcurrently (relationOid=relationOid@entry=17618, options=options@entry=0) at indexcmds.c:3090 heapRelationIds = 0x1d30360 indexIds = 0x1d303b0 newIndexIds = relationLocks = lockTags = lc = 0x0 lc2 = 0x0 private_context = oldcontext = relkind = 105 'i' relationName = 0x0 relationNamespace = 0x0 ru0 = {tv = {tv_sec = 30592544, tv_usec = 7232025}, ru = {ru_utime = {tv_sec = 281483566645394, tv_usec = 75668733820930}, ru_stime = {tv_sec = 0, tv_usec = 30592272}, { ru_maxrss = 0, __ru_maxrss_word = 0}, {ru_ixrss = 0, __ru_ixrss_word = 0}, {ru_idrss = 105, __ru_idrss_word = 105}, {ru_isrss = -926385342574214656, __ru_isrss_word = -926385342574214656}, {ru_minflt = 8924839, __ru_minflt_word = 8924839}, {ru_majflt = 0, __ru_majflt_word = 0}, {ru_nswap = 17618, __ru_nswap_word = 17618}, {ru_inblock = 139781327898864, __ru_inblock_word = 139781327898864}, {ru_oublock = 30430312, __ru_oublock_word = 30430312}, { ru_msgsnd = 139781327898864, __ru_msgsnd_word = 139781327898864}, {ru_msgrcv = 139781327898864, __ru_msgrcv_word = 139781327898864}, {ru_nsignals = 139781327898864, __ru_nsignals_word = 139781327898864}, {ru_nvcsw = 139781327898864, __ru_nvcsw_word = 139781327898864}, {ru_nivcsw = 139781327898864, __ru_nivcsw_word = 139781327898864}}} __func__ = "ReindexRelationConcurrently" #2 0x00000000005c328a in ReindexIndex (indexRelation=, options=0, concurrent=) at indexcmds.c:2352 state = {concurrent = true, locked_table_oid = 17608} indOid = 17618 irel = persistence = 112 'p' ...