PL/Perl crash when using threaded perl
PL/Perl crash when using threaded perl
Hi,
I was recently running both pl/perl and pl/perlu functions in a single
session, coming across the error message about failure to allocate a
second Perl interpreter on my platform. I'm running PostgreSQL 8.3.7
built from the sources on Mac OS X 10.5 with perl installed from
macports (macports were synced recently and up-to-date). I've noticed
that threads are not enabled in the macports package.
Then I've reinstalled Perl, enabling a build with threading support,
since the documentation on PL/Perl hinted me on this.
My macports package looks like this:
alexk$ port echo perl5.8 and installed
perl5.8 @5.8.9_3+shared+threads
and the Perl flags are:
alexk$ perl -V
....
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP
USE_FAST_STDIO USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API
Built under darwin
Compiled at Aug 10 2009 16:57:14
@INC:
/opt/local/lib/perl5/site_perl/5.8.9/darwin-thread-multi-2level
/opt/local/lib/perl5/site_perl/5.8.9
/opt/local/lib/perl5/site_perl
/opt/local/lib/perl5/vendor_perl/5.8.9/darwin-thread-multi-2level
/opt/local/lib/perl5/vendor_perl/5.8.9
/opt/local/lib/perl5/vendor_perl
/opt/local/lib/perl5/5.8.9/darwin-thread-multi-2level
/opt/local/lib/perl5/5.8.9
Now PL/Perl just crashes a backend even when I try to create a
language itself.
postgres=# create language plperl;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
and gdb tells me this:
Attaching to program: `/usr/local/pgsql/bin/postgres', process 9067.
Reading symbols for shared libraries ++. done
0x9403a749 in recvfrom$UNIX2003 ()
(gdb) c
Continuing.
Reading symbols for shared libraries ... done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000004
0x035048f5 in Perl_sv_replace ()
bt full from the running process is attached. Is there a problem with
perl built via macports (I can see both USE_ITHREADS and MULTIPLICITY,
although documentation tells about building with either of them), or
is this a bug in PL/Perl ?
Thanks,
--
Alexey Klyukin http://www.CommandPrompt.com
The PostgreSQL Company - Command Prompt, Inc.
Re: PL/Perl crash when using threaded perl
От:
Andrew Dunstan <andrew@dunslane.net>
Дата:
Alexey Klyukin wrote: > Hi, > > I was recently running both pl/perl and pl/perlu functions in a single > session, coming across the error message about failure to allocate a > second Perl interpreter on my platform. I'm running PostgreSQL 8.3.7 > built from the sources on Mac OS X 10.5 with perl installed from > macports (macports were synced recently and up-to-date). I've noticed > that threads are not enabled in the macports package. > > Then I've reinstalled Perl, enabling a build with threading support, > since the documentation on PL/Perl hinted me on this. > My macports package looks like this: > > alexk$ port echo perl5.8 and installed > perl5.8 @5.8.9_3+shared+threads > > and the Perl flags are: > > alexk$ perl -V > .... > Characteristics of this binary (from libperl): > Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT > PERL_MALLOC_WRAP > USE_FAST_STDIO USE_ITHREADS USE_LARGE_FILES > USE_PERLIO USE_REENTRANT_API > Built under darwin > Compiled at Aug 10 2009 16:57:14 > @INC: > /opt/local/lib/perl5/site_perl/5.8.9/darwin-thread-multi-2level > /opt/local/lib/perl5/site_perl/5.8.9 > /opt/local/lib/perl5/site_perl > /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-thread-multi-2level > /opt/local/lib/perl5/vendor_perl/5.8.9 > /opt/local/lib/perl5/vendor_perl > /opt/local/lib/perl5/5.8.9/darwin-thread-multi-2level > /opt/local/lib/perl5/5.8.9 > > Now PL/Perl just crashes a backend even when I try to create a > language itself. > > postgres=# create language plperl; > server closed the connection unexpectedly > This probably means the server terminated abnormally > before or while processing the request. > The connection to the server was lost. Attempting reset: Failed. > > and gdb tells me this: > > Attaching to program: `/usr/local/pgsql/bin/postgres', process 9067. > Reading symbols for shared libraries ++. done > 0x9403a749 in recvfrom$UNIX2003 () > (gdb) c > Continuing. > Reading symbols for shared libraries ... done > > Program received signal EXC_BAD_ACCESS, Could not access memory. > Reason: KERN_PROTECTION_FAILURE at address: 0x00000004 > 0x035048f5 in Perl_sv_replace () > > bt full from the running process is attached. Is there a problem with > perl built via macports (I can see both USE_ITHREADS and MULTIPLICITY, > although documentation tells about building with either of them), or > is this a bug in PL/Perl ? I wonder if this is another case of the lack of perl library initialisation bug we have seen before. Can you try with this patch to the postgres 8.3 sources? We haven't put out an 8.3 release that includes that patch yet. cheers andrew
Re: PL/Perl crash when using threaded perl
От:
Alexey Klyukin <alexk@waki.ru>
Дата:
On Mon, Aug 10, 2009 at 10:09 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
-- I wonder if this is another case of the lack of perl library initialisation bug we have seen before. Can you try with this patch to the postgres 8.3 sources? <http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/plperl.c.diff?r1=1.136;r2=1.136.2.2>
We haven't put out an 8.3 release that includes that patch yet.
Thanks, Andrew, this patch solved the problem.
Alexey Klyukin wwww.commandprompt.com
The PostgreSQL Company - Command Prompt, Inc