Re: segfault in 9.5alpha - plpgsql function, implicit cast and IMMUTABLE cast function

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: segfault in 9.5alpha - plpgsql function, implicit cast and IMMUTABLE cast function
Date: 2015-07-17 12:49:57
Message-ID: CAB7nPqTntrP6WJLUP4CiNALN243hdQ8LJQupt6rQ_r9rx5Ko5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 17, 2015 at 7:52 PM, Geoff Winkless <pgsqladmin(at)geoff(dot)dj> wrote:
> While doing some testing of 9.5a one of my colleagues (not on list) found a
> reproducible server segfault.
> [...]
> Hope someone can get something useful from the above. Any questions, please
> ask.

A test case is more than enough to look at this issue and guess what
is happening, thanks! The issue can be reproduced on REL9_5_STABLE and
master, and by looking at the stack trace it seems that the problem is
caused by an attempt to delete a memory context that has already been
free'd.

* thread #1: tid = 0x0000, 0x0000000109f30dee
postgres`MemoryContextDelete(context=0x7f7f7f7f7f7f7f7f) + 30 at
mcxt.c:206, stop reason = signal SIGSTOP
frame #0: 0x0000000109f30dee
postgres`MemoryContextDelete(context=0x7f7f7f7f7f7f7f7f) + 30 at
mcxt.c:206
203 void
204 MemoryContextDelete(MemoryContext context)
205 {
-> 206 AssertArg(MemoryContextIsValid(context));
207 /* We had better not be deleting TopMemoryContext ... */
208 Assert(context != TopMemoryContext);
209 /* And not CurrentMemoryContext, either */
(lldb) bt
* thread #1: tid = 0x0000, 0x0000000109f30dee
postgres`MemoryContextDelete(context=0x7f7f7f7f7f7f7f7f) + 30 at
mcxt.c:206, stop reason = signal SIGSTOP
* frame #0: 0x0000000109f30dee
postgres`MemoryContextDelete(context=0x7f7f7f7f7f7f7f7f) + 30 at
mcxt.c:206
frame #1: 0x0000000109b7e261
postgres`fmgr_sql(fcinfo=0x00007f84c28d5870) + 433 at functions.c:1044

I am adding it to the list of Open Items for 9.5. I'll look into that
in the next couple of days (Tuesday at worst).
Regards,
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Ramsey 2015-07-17 12:51:19 Re: [PATCH] postgres_fdw extension support
Previous Message Robert Haas 2015-07-17 12:42:40 Re: [PATCH] Function to get size of asynchronous notification queue