2011-09-14 11:08:22 CEST STATEMENT: create function perl_test() returns
void as $$ $$ language plperl
2011-09-14 11:08:47 CEST LOG: server process (PID 560) was terminated by
exception 0xC0000005
2011-09-14 11:08:47 CEST HINT: See C include file "ntstatus.h" for a
description of the hexadecimal value.
2011-09-14 11:08:47 CEST LOG: terminating any other active server
processes
2011-09-14 11:08:47 CEST WARNING: terminating connection because of crash
of another server process
2011-09-14 11:08:47 CEST DETAIL: The postmaster has commanded this server
process to roll back the current transaction and exit, because another
server process exited abnormally and possibly corrupted shared memory.
2011-09-14 11:08:47 CEST HINT: In a moment you should be able to reconnect
to the database and repeat your command.
2011-09-14 11:08:47 CEST WARNING: terminating connection because of crash
of another server process
2011-09-14 11:08:47 CEST DETAIL: The postmaster has commanded this server
process to roll back the current transaction and exit, because another
server process exited abnormally and possibly corrupted shared memory.
2011-09-14 11:08:47 CEST HINT: In a moment you should be able to reconnect
to the database and repeat your command.
2011-09-14 11:08:47 CEST WARNING: terminating connection because of crash
of another server process
2011-09-14 11:08:47 CEST DETAIL: The postmaster has commanded this server
process to roll back the current transaction and exit, because another
server process exited abnormally and possibly corrupted shared memory.
2011-09-14 11:08:47 CEST HINT: In a moment you should be able to reconnect
to the database and repeat your command.
2011-09-14 11:08:47 CEST LOG: all server processes terminated;
reinitializing
2011-09-14 11:08:57 CEST FATAL: pre-existing shared memory block is still
in use
2011-09-14 11:08:57 CEST HINT: Check if there are any old server processes
still running, and terminate them.

Re: BUG #6204: Using plperl functions generate crash

Not all of us can do that. I had the same issue with the EnterpriseDB
PostgreSQL 9.1.1 installer and ActivePerl 5.14.1 on MS Windows XP Professional
2002 SP3. Will try again with the zip file, but I guess the 9.1.1 binaries are
useless to me.

Re: BUG #6204: Using plperl functions generate crash

Not all of us can do that. I had the same issue with the EnterpriseDBPostgreSQL 9.1.1 installer and ActivePerl 5.14.1 on MS Windows XP Professional2002 SP3. Will try again with the zip file, but I guess the 9.1.1 binaries areuseless to me.

2011-12-21 08:10:49 PST LOG: server process (PID 7296) was terminated by exception 0xC0000005
2011-12-21 08:10:49 PST HINT: See C include file "ntstatus.h" for a description of the hexadecimal value.
2011-12-21 08:10:49 PST LOG: terminating any other active server processes
2011-12-21 08:10:49 PST WARNING: terminating connection because of crash of another server process
2011-12-21 08:10:49 PST DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2011-12-21 08:10:49 PST HINT: In a moment you should be able to reconnect to the database and repeat your command.
2011-12-21 08:10:49 PST LOG: all server processes terminated; reinitializing
2011-12-21 08:10:59 PST FATAL: pre-existing shared memory block is still in use
2011-12-21 08:10:59 PST HINT: Check if there are any old server processes still running, and terminate them.

But here is what will work:
1. Compile postgresql-9.1.3 using mingw32
2. Replace only the plperl.dll the official binaries supply with the plperl.dll you get from the mingw32 compile
3. Then the test which started this bug discussion works.

This makes me think there is an incompatibility in some environments related to plperl. I thought maybe it was the version of msvcr90.dll since the mingw32 compile doesn't link with it. I've got four versions of it on my XP test box, and have put each version of that dll in my various install subdirectories (perl\bin, perl\lib, pgsql\bin, pgsql\lib), and none of them make a difference (assuming it is seeing them "first").

If it is an environment issue of some kind it would be interesting to know what locales people have where it works versus where it doesn't. I'm using the standard ones that the PostgreSQL one-click installer defaults to.

Re: BUG #6204: Using plperl functions generate crash

ljwilson wrote

But here is what will work:
1. Compile postgresql-9.1.3 using mingw32
2. Replace only the plperl.dll the official binaries supply with the plperl.dll you get from the mingw32 compile
3. Then the test which started this bug discussion works.

Where the last post in the thread talks about mismatches between MSVCR80.dll and MSVCRT.DLL causing the same crash in Perl 5.10. I think we have the same issue here between ActiveState Perl using MSVCRT.DLL and PLPERL.DLL compiled with the MS compilers using MSVCR90.DLL.

So another solution which I've tested (and it works for me) is to compile Perl 5.14.2 from source using the Windows Platform SDK 7.0 (same one I used to compile PostgreSQL 9.1.3 in my previous post). To do that I changed the CCTYPE = MSVC90 in <perl source directory>\win32\Makefile. This forces Perl to use the same MSVCR90.DLL that PLPERL.DLL (and PostgreSQL itself) uses.

What I still don't understand is why ActiveState 5.14.1 and 5.14.2 work for some people with the official Postgresql 9.1.x binaries and not others.

Since I distribute my own compiled version of Perl anyway, for PostgreSQL 9.1.x I will simply compile Perl with the Windows Platform SDK 7.0 instead of mingw32.