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.