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 20100114204506.GK8024@timac.local
Whole thread Raw
In response to Re: Termination When Switching between PL/Perl and PL/PerlU  (Tim Bunce <Tim.Bunce@pobox.com>)
Responses 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 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 ...
>
> I added this to src/pl/plperl/sql/plperl_plperlu.sql:
> -- recompile same function with different languages
> create or replace function wtf(text) returns text language plperl as 'shift';
> select wtf('hey');
> create or replace function wtf(text) returns text language plperlu as 'shift';
> select wtf('hey');
> create or replace function wtf(text) returns text language plperl as 'shift';
> select wtf('hey');
>
> The first two work ok, the third causes:
> LOG:  server process (PID 41692) was terminated by signal 10: Bus error

> 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.

Tim.

pgsql-bugs by date:

Previous
From: Oleg Jurtšenko
Date:
Subject: Re: BUG #5235: Segmentation fault under high load through JDBC
Next
From: "Murali"
Date:
Subject: BUG #5278: Postgres hangs / crashes every day