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

2015-07-18 Thread Michael Paquier
On Fri, Jul 17, 2015 at 11:37 PM, Tom Lane t...@sss.pgh.pa.us wrote:
 Geoff Winkless pgsqlad...@geoff.dj writes:
 While doing some testing of 9.5a one of my colleagues (not on list) found a
 reproducible server segfault.

 Hm, looks like commit 1345cc67bbb014209714af32b5681b1e11eaf964 is to
 blame: memory management for the plpgsql cast cache needs to be more
 complicated than I realized :-(.

And this issue is already fixed by 0fc94a5b.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


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

2015-07-17 Thread Tom Lane
Geoff Winkless pgsqlad...@geoff.dj writes:
 While doing some testing of 9.5a one of my colleagues (not on list) found a
 reproducible server segfault.

Hm, looks like commit 1345cc67bbb014209714af32b5681b1e11eaf964 is to
blame: memory management for the plpgsql cast cache needs to be more
complicated than I realized :-(.

regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


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

2015-07-17 Thread Michael Paquier
On Fri, Jul 17, 2015 at 7:52 PM, Geoff Winkless pgsqlad...@geoff.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 = 0x, 0x000109f30dee
postgres`MemoryContextDelete(context=0x7f7f7f7f7f7f7f7f) + 30 at
mcxt.c:206, stop reason = signal SIGSTOP
frame #0: 0x000109f30dee
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 = 0x, 0x000109f30dee
postgres`MemoryContextDelete(context=0x7f7f7f7f7f7f7f7f) + 30 at
mcxt.c:206, stop reason = signal SIGSTOP
  * frame #0: 0x000109f30dee
postgres`MemoryContextDelete(context=0x7f7f7f7f7f7f7f7f) + 30 at
mcxt.c:206
frame #1: 0x000109b7e261
postgres`fmgr_sql(fcinfo=0x7f84c28d5870) + 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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers