Re: Server process crash - Segmentation fault

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Leif Jensen <leif(at)crysberg(dot)dk>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Server process crash - Segmentation fault
Date: 2014-05-07 16:11:41
Message-ID: 29568.1399479101@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

Leif Jensen <leif(at)crysberg(dot)dk> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-05-07 16:43:46 Re: BUG #10255: CREATE COLLATION bug on 9.4
Previous Message emanuel.calvo 2014-05-07 15:59:18 BUG #10255: CREATE COLLATION bug on 9.4

Browse pgsql-general by date

  From Date Subject
Next Message Ravi Roy 2014-05-07 16:23:45 Re: probable pg_hba.conf configuration issues
Previous Message Andrus 2014-05-07 16:03:29 How to fix lost synchronization with server