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>
Subject: Re: Termination When Switching between PL/Perl and PL/PerlU
Date: 2010-01-14 20:45:06
Message-ID: 20100114204506.GK8024@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Murali 2010-01-14 22:49:02 BUG #5278: Postgres hangs / crashes every day
Previous Message Oleg Jurtšenko 2010-01-14 20:22:53 Re: BUG #5235: Segmentation fault under high load through JDBC