Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi4Rg-0007r7-CG for pgsql-general@arkaria.postgresql.org; Wed, 07 May 2014 16:11:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wi4Rf-00077j-Pi for pgsql-general@arkaria.postgresql.org; Wed, 07 May 2014 16:11:47 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi4Re-00077Y-Nk; Wed, 07 May 2014 16:11:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi4Rc-0004B9-5I; Wed, 07 May 2014 16:11:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s47GBfWC029569; Wed, 7 May 2014 12:11:41 -0400 From: Tom Lane To: Leif Jensen cc: Adrian Klaver , pgsql-general , pgsql-bugs@postgresql.org Subject: Re: Server process crash - Segmentation fault In-reply-to: <12460598.10774.1399477600310.JavaMail.root@quick> References: <12460598.10774.1399477600310.JavaMail.root@quick> Comments: In-reply-to Leif Jensen message dated "Wed, 07 May 2014 17:46:40 +0200" Date: Wed, 07 May 2014 12:11:41 -0400 Message-ID: <29568.1399479101@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Leif Jensen writes: > Here is a gdb dump of the backtrace at the server process crash. I have also included the code that generates these calls. As mentioned below this specific connection has been used many times before the crash. Also, we are aware of the thread caveat that only using a connection from one thread at a time. Therefore the "strange" connection name that includes both the process id and the thread id. This is for the code to make sure that a connection is only used in the thread it is meant to. Hm. The crash looks like it must be because ActiveSnapshot is null (not set). Since we're doing a FETCH, the active snapshot ought to be the one saved for the cursor query by DECLARE CURSOR. It looks like the problem is that pquery.c only bothers to install that as the active snapshot while calling ExecutorRun, but in this stack trace we're in ExecutorRewind. I wonder if it's a bad idea for ExecReScanLimit to be executing user-defined expressions? But it's been like that for awhile, and I think we might have a hard time preserving the bounded-sort optimization if we didn't do that. Anyway the simple fix would be to ensure we install the query snapshot as active before calling ExecutorRewind. One interesting question is why this issue hasn't been seen before; it seems like it'd not be that hard to hit. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general