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 1hnB89-0000gz-Re for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jul 2019 00:15:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hnB87-0001KQ-K4 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jul 2019 00:15:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnB87-0001Ii-BN for pgsql-hackers@lists.postgresql.org; Tue, 16 Jul 2019 00:15:39 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnB84-0002dM-14 for pgsql-hackers@postgresql.org; Tue, 16 Jul 2019 00:15:38 +0000 Received: by mail-wm1-x334.google.com with SMTP id s15so16848415wmj.3 for ; Mon, 15 Jul 2019 17:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-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=9mpcwfK8QU2hO+NISvT5O58mfdoGzVeSC5EKyEP45Kk=; b=g9aFfTyebiycuy4CSU0Z64CEIShlsR3hTGQBr6qBoJ2wzrC/zoVAyQZHse13H7nTG9 u8/Xv7reniR8xnTZJcmti4Ncj9Up1E3uKfV7kS6cP7jGF1dPVnXQUeHKW0SZ5ZNl6tOh Y6YtVvGTN7vwgsvUrem2Ey/bViHnWlA1yVP5H0FbgHaocaG7Lae6aff0eVJdSlF0w9fA WFxtEHZAF57BYb2ZHsazENN3CVg/SpNHqjY2JUezIWCT2zOd5tf8lPoRkE2E5xJiQ7OM i31zezQB+sXSmcEqy/mQvnqkhkI6nTnoxegKaYtNgcImQQbBIYtmoDAZTcMkHj+ye/Og Uv4w== 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=9mpcwfK8QU2hO+NISvT5O58mfdoGzVeSC5EKyEP45Kk=; b=AapxoMD9hlV5u8rN3foaeyYm8e5B7UpxX91cnmzxJ+JyjAe7vQ+kC28IGeewcCPLYu z7gN+ORfch/UizTCVREv9VOz7khX09TQk9gxz36RkoAFakkmq2FtVcR0hv2IO1kfi0WW 4XCtDDkeYo+Tl6fwc7YKNk3KfIg56EjQOZJDWPcCnBYS2VvZ6e1Mm4wM0ZSBwBT2Y1An TMSaHrxTESTxWaZpA0PRMCqJUoS0deiT6lLuEpK7SMpyzH0clWegkG/mFHbtp3zAT/WN +ObvDu691h3jQSUOYS7wiiLYNsexdtcU71eVctjSiWNFQ2CRgg3ZdIgoCRUv+0A37oX8 nDxg== X-Gm-Message-State: APjAAAVUfwbia/usNr2Wm6EdxnNSvH5L9pG6To27bOOXZoIBDIkL2AJ8 9HFoip9OjB47Y1UDSyEDDvusbA== X-Google-Smtp-Source: APXvYqxJnw0oXFrQ2pojuMkjavrMdm+LT9j1fSaSiFlpbMYMrWDkiQfBPQIQXKjHnX6SAA/LsNOMjg== X-Received: by 2002:a1c:2d8b:: with SMTP id t133mr26568124wmt.57.1563236134649; Mon, 15 Jul 2019 17:15:34 -0700 (PDT) Received: from localhost (ip-86-49-253-160.net.upcbroadband.cz. [86.49.253.160]) by smtp.gmail.com with ESMTPSA id w67sm21585605wma.24.2019.07.15.17.15.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 17:15:31 -0700 (PDT) Date: Tue, 16 Jul 2019 02:15:29 +0200 From: Tomas Vondra To: Jerry Sievers Cc: pgsql-hackers@postgresql.org Subject: Re: SegFault on 9.6.14 Message-ID: <20190716001529.uvpfngvxtlu5h2fr@development> References: <87ims2amh6.fsf@jsievers.enova.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87ims2amh6.fsf@jsievers.enova.com> User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Jul 15, 2019 at 06:48:05PM -0500, Jerry Sievers wrote: >Greetings Hackers. > >We have a reproduceable case of $subject that issues a backtrace such as >seen below. > >The query that I'd prefer to sanitize before sending is <30 lines of at >a glance, not terribly complex logic. > >It nonetheless dies hard after a few seconds of running and as expected, >results in an automatic all-backend restart. > >Please advise on how to proceed. Thanks! > >bt >#0 initscan (scan=scan@entry=0x55d7a7daa0b0, key=0x0, keep_startblock=keep_startblock@entry=1 '\001') > at /build/postgresql-9.6-5O8OLM/postgresql-9.6-9.6.14/build/../src/backend/access/heap/heapam.c:233 >#1 0x000055d7a72fa8d0 in heap_rescan (scan=0x55d7a7daa0b0, key=key@entry=0x0) at /build/postgresql-9.6-5O8OLM/postgresql-9.6-9.6.14/build/../src/backend/access/heap/heapam.c:1529 >#2 0x000055d7a7451fef in ExecReScanSeqScan (node=node@entry=0x55d7a7d85100) at /build/postgresql-9.6-5O8OLM/postgresql-9.6-9.6.14/build/../src/backend/executor/nodeSeqscan.c:280 >#3 0x000055d7a742d36e in ExecReScan (node=0x55d7a7d85100) at /build/postgresql-9.6-5O8OLM/postgresql-9.6-9.6.14/build/../src/backend/executor/execAmi.c:158 >#4 0x000055d7a7445d38 in ExecReScanGather (node=node@entry=0x55d7a7d84d30) at /build/postgresql-9.6-5O8OLM/postgresql-9.6-9.6.14/build/../src/backend/executor/nodeGather.c:475 >#5 0x000055d7a742d255 in ExecReScan (node=0x55d7a7d84d30) at /build/postgresql-9.6-5O8OLM/postgresql-9.6-9.6.14/build/../src/backend/executor/execAmi.c:166 >#6 0x000055d7a7448673 in ExecReScanHashJoin (node=node@entry=0x55d7a7d84110) at /build/postgresql-9.6-5O8OLM/postgresql-9.6-9.6.14/build/../src/backend/executor/nodeHashjoin.c:1019 >#7 0x000055d7a742d29e in ExecReScan (node=node@entry=0x55d7a7d84110) at /build/postgresql-9.6-5O8OLM/postgresql-9.6-9.6.14/build/../src/backend/executor/execAmi.c:226 > > Hmmm, that means it's crashing here: if (scan->rs_parallel != NULL) scan->rs_nblocks = scan->rs_parallel->phs_nblocks; <--- here else scan->rs_nblocks = RelationGetNumberOfBlocks(scan->rs_rd); But clearly, scan is valid (otherwise it'd crash on the if condition), and scan->rs_parallel must me non-NULL. Which probably means the pointer is (no longer) valid. Could it be that the rs_parallel DSM disappears on rescan, or something like that? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services