Re: Termination When Switching between PL/Perl and PL/PerlU - Mailing list pgsql-bugs

From Tim Bunce
Subject Re: Termination When Switching between PL/Perl and PL/PerlU
Date
Msg-id 20100125124007.GA78082@timac.local
Whole thread Raw
In response to Re: Termination When Switching between PL/Perl and PL/PerlU  (Tim Bunce <Tim.Bunce@pobox.com>)
List pgsql-bugs
On Thu, Jan 14, 2010 at 08:45:06PM +0000, Tim Bunce wrote:
> On Thu, Jan 14, 2010 at 06:41:52PM +0000, Tim Bunce wrote:
> > > > David E. Wheeler wrote:
> > > >> Found in 8.4.2, replicated in HEAD. Steps:
> > > >>
> > > >> 1. Create PL/Perl function.
> > > >> 2. Run it.
> > > >> 3. Create same function with PL/PerlU
> > > >> 4. Run it.
> > > >> 5. Create same function again with PL/Perl
> > > >> 6. Boom.
> > >
> > > panic: free from wrong pool.
> > > LOG:  server process (PID 15697) exited with exit code 255
> > >
> > > There's no core dump (thank you, perl). The lower-case panic message
> > > must be from libperl because PG has no such message.  I guess that we
> > > probably need to fix this by changing the timing of interpreter
> > > switching relative to throwing away the old compiled function ...
> >
> > [...]
>
> > That was using a cvs head (via git) from ~ the 9th of Jan.
> > I got the same failure after applying my feature1a-utils patch,
> > but then applying my feature1b-misc patch fixed it.
>
> Not quite out of the woods. My next patch adds in destruction of the
> perl interpreters. That's showing the 'wrong pool' in a different way:
>
>     Scalars leaked: -1
>     Scalars leaked: 1
>
> I want to get some more patches into the commitfest before it closes.
> After that I'll look into this some more, if someone else hasn't got to
> it first.

The attached patch fixes the (longstanding) problem.

It should apply cleanly over the "Miscellaneous changes to plperl"
patch (which I believe Andrew Dunstan intends to commit shortly).

A backport of the core fix in plperl.c should be simple.

Tim.


Attachment

pgsql-bugs by date:

Previous
From: Euler Taveira de Oliveira
Date:
Subject: Re: BUG #5295: Function OUT parameters names and data types skewed with IN parameters
Next
From: WildWezyr
Date:
Subject: Re: BUG #5290: Simple loop with insert into and check to avoid duplicate values fails