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 1iJgjq-0005t2-65 for pgsql-hackers@arkaria.postgresql.org; Sun, 13 Oct 2019 16:28:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iJgga-0000NA-Vb for pgsql-hackers@arkaria.postgresql.org; Sun, 13 Oct 2019 16:25:36 +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 1iJgfY-0000Ly-Kl for pgsql-hackers@lists.postgresql.org; Sun, 13 Oct 2019 16:24: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 1iJgfV-0003p4-7a for pgsql-hackers@lists.postgresql.org; Sun, 13 Oct 2019 16:24:31 +0000 Received: by mail-io1-xd41.google.com with SMTP id v2so32203098iob.10 for ; Sun, 13 Oct 2019 09:24:28 -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=LuMqZmHTUe6UyOmU1/jIDaKU0fATyBvcxpuxlw9q9N8=; b=pwS/UQkKgKeGZr8zQ7ktZaqmXyg/RCVeVao0Y76S8WDZRxZTLH+swwwSetFHsDx0Ew PvfoJu4ml08xC/5DBrfCHwSSwb6vuXMtmWk6ydfrG6GoQy+/A4sSZXFPSis3BMRP84sB j7wWKfc1qoGb2cp1lIRsjNfWLyng0dGfnY/re+Uv1taTe5yA4ySyBoyQQT49dFGoA80o 04ap2mPwkjh+4AjHsqvX5aaaXZOHxW6shLA/pLUSqvAf+aVwp5hr8iXkWQkDyBpMMyOx zRP6NZ6Or+2V85wfrlAkbABo0JDB/4T6d/Mv3RvF+cR6bKTLvIWml10DC5YBzodNpWJr NihA== 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=LuMqZmHTUe6UyOmU1/jIDaKU0fATyBvcxpuxlw9q9N8=; b=SqriOUNE0B87zVYylNzALV9Waa+OdByB6ZT4r5U8HOTnXF7GZNIVswJ5BxbOHdpF8/ ZdAkuSqiAK0rGtxBHWLHiPJI2/iP8/2gOW4nLWqmaaZakZQHF0nyjQOXHvCGWS4Mc6w1 ZokW1irb6Wv3ShUDzznQ1dfq0dlYbhPhwGN8EL+fKwV0hFjnjbOl1xylskkankWQAPtr KWZK0LkVp+RFLjl3fkOIA97sO+b0cr97VGk14nCfmcJzJIhlj8G8prmxjm0BvpZ3Q3j2 VCFZxpCFvoKvpS6UMWCAhATRz72RHrPYTGgThQnYv2UFsGMdwmSp5k4GKm2S7QAVOQnQ Z/dw== X-Gm-Message-State: APjAAAVmDJDlTdRrfkeYU9C2fSDlc4iKTHReUGJAdTVcE25FdoD4KZTq QDnkoJrS/aD7OZUuhxIXmy0gXA== X-Google-Smtp-Source: APXvYqxxhRbcCBkeebVMepRdn2LqNGi0xPFap9uL6BvMiWWYVD6LB/LmCNAfI+zjxcMuAp7foBgGAA== X-Received: by 2002:a02:90c7:: with SMTP id c7mr31639864jag.12.1570983868350; Sun, 13 Oct 2019 09:24:28 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id f12sm10607017iob.58.2019.10.13.09.24.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Oct 2019 09:24:27 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 9F19A8011CB; Sun, 13 Oct 2019 11:24:26 -0500 (CDT) Date: Sun, 13 Oct 2019 11:24:26 -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: <20191013162426.GF4475@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 Resending this message, which didn't make it to the list when I sent it earlier. (And, notified -www). 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' ...