Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TCDWM-00028G-Hr for pgsql-bugs@postgresql.org; Thu, 13 Sep 2012 17:48:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TCDWJ-0001N4-Tx for pgsql-bugs@postgresql.org; Thu, 13 Sep 2012 17:48:09 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q8DHm48X017685; Thu, 13 Sep 2012 13:48:05 -0400 (EDT) From: Tom Lane To: Marko Tiikkaja cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7516: PL/Perl crash In-reply-to: <50506B94.5040003@joh.to> References: <1194.1346688396@sss.pgh.pa.us> <5047BA9C.2040405@joh.to> <16153.1347226320@sss.pgh.pa.us> <17785.1347230278@sss.pgh.pa.us> <504F8034.20802@joh.to> <4011.1347407415@sss.pgh.pa.us> <50506B94.5040003@joh.to> Comments: In-reply-to Marko Tiikkaja message dated "Wed, 12 Sep 2012 13:01:40 +0200" Date: Thu, 13 Sep 2012 13:48:04 -0400 Message-ID: <17684.1347558484@sss.pgh.pa.us> X-Pg-Spam-Score: -2.4 (--) X-Archive-Number: 201209/123 X-Sequence-Number: 34118 Marko Tiikkaja writes: > On 9/12/12 1:50 AM, Tom Lane wrote: >> Marko Tiikkaja writes: >>> Joel Jacobson managed to narrow it down to this test case, which crashes >>> consistently on Ubuntu 12.04 both with and without your patch. I, >>> however, wasn't able to reproduce the problem on my OS X Mountain Lion. >> Doesn't reproduce for me either ... > Ok, I can reproduce it on my Ubuntu virtual machine. Hm, I wonder if it's Ubuntu-specific? What Perl version is that exactly? > What happens is that free_plperl_function() for some reason gets called > with the prodesc of func0003. Later on, func0003 wants to get rid of > his prodesc and I get a crash. What's weird about this is that > current_call_data->prodesc actually points to the correct prodesc (the > one of func0005), but still somehow something different is passed to > free_plperl_function(). The only theory that comes to mind is that current_call_data is somehow getting aliased (free'd and realloc'd). I don't see how that could happen, but it occurs to me that it's kinda dumb to be palloc'ing it in the first place. Its lifetime is exactly that of the call, so it would be simpler and more foolproof to make it a local variable. I've pushed a HEAD patch to do that, and I wonder if you could check whether it changes anything. regards, tom lane