Re: Termination When Switching between PL/Perl and PL/PerlU

From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Termination When Switching between PL/Perl and PL/PerlU
Date: 2010-01-25 12:40:07
Message-ID: 20100125124007.GA78082@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
plperl-freetowrongpool.patch text/x-patch 3.4 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Milen A. Radev 2010-01-25 19:49:02 Re: BUG #5290: Simple loop with insert into and check to avoid duplicate values fails
Previous Message WildWezyr 2010-01-25 09:50:41 Re: BUG #5290: Simple loop with insert into and check to avoid duplicate values fails