PL/Perl crash when using threaded perl

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: PL/Perl crash when using threaded perl
Date: 2009-08-10 18:47:14
Message-ID: 0DFDF0F3-242D-43DF-8BA7-B7D29D5DB15B@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 ?

Attachment Content-Type Size
gdb.txt text/plain 6.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2009-08-10 18:51:12 Re: Shipping documentation untarred
Previous Message Tom Lane 2009-08-10 18:44:48 Re: [HACKERS] BUG #4961: pg_standby.exe crashes with no args