Thread: BUG #6204: Using plperl functions generate crash

BUG #6204: Using plperl functions generate crash

From
"pasman"
Date:
The following bug has been logged online:

Bug reference:      6204
Logged by:          pasman
Email address:      pasman.p@gmail.com
PostgreSQL version: 9.1.0
Operating system:   WinXP sp3
Description:        Using plperl functions generate crash
Details:

After install postgresql 9.1.0 and Activestate perl 5.14.1 execute:

create function perl_test() returns void as
$$
$$
language plperl


This generates server crash. Log contain:


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

From
Alex Hunsaker
Date:
On Wed, Sep 14, 2011 at 03:15, pasman <pasman.p@gmail.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference: =C2=A0 =C2=A0 =C2=A06204
> Logged by: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pasman
> Email address: =C2=A0 =C2=A0 =C2=A0pasman.p@gmail.com
> PostgreSQL version: 9.1.0
> Operating system: =C2=A0 WinXP sp3
> Description: =C2=A0 =C2=A0 =C2=A0 =C2=A0Using plperl functions generate c=
rash
> Details:
>
> After install postgresql 9.1.0 and Activestate perl 5.14.1 execute:
>
> create function perl_test() returns void as
> $$
> $$
> language plperl

My hunch is the binary distribution of postgres you are using was
compiled with a different version (or brand, maybe strawberry?) of
perl in mind.

I don't know what installer you used, I'd guess the one from
enterprisedb. I looked around for a bit on their website but didn't
see what flavor of perl for windows it wants... :-(

Re: BUG #6204: Using plperl functions generate crash

From
Sachin Srivastava
Date:
On Sep 15, 2011, at 3:47 AM, Alex Hunsaker wrote:

> On Wed, Sep 14, 2011 at 03:15, pasman <pasman.p@gmail.com> wrote:
>>
>> The following bug has been logged online:
>>
>> Bug reference:      6204
>> Logged by:          pasman
>> Email address:      pasman.p@gmail.com
>> PostgreSQL version: 9.1.0
>> Operating system:   WinXP sp3
>> Description:        Using plperl functions generate crash
>> Details:
>>
>> After install postgresql 9.1.0 and Activestate perl 5.14.1 execute:
>>
>> create function perl_test() returns void as
>> $$
>> $$
>> language plperl
>
> My hunch is the binary distribution of postgres you are using was
> compiled with a different version (or brand, maybe strawberry?) of
> perl in mind.
>
> I don't know what installer you used, I'd guess the one from
> enterprisedb. I looked around for a bit on their website but didn't
> see what flavor of perl for windows it wants... :-(

One-Click Installers uses ActiveState Perl 5.14 only.

>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

--
Regards,
Sachin Srivastava
EnterpriseDB, the Enterprise PostgreSQL company.

Re: BUG #6204: Using plperl functions generate crash

From
pasman pasmański
Date:
Problem solved:
I reinstall postgres from sources, works.



------------
pasman


Re: BUG #6204: Using plperl functions generate crash

From
Leandro
Date:
pasman pasmański <pasman.p <at> gmail.com> writes:
>
> Problem solved:
> I reinstall postgres from sources, works.

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

From
Sachin Srivastava
Date:
On Oct 10, 2011, at 11:19 PM, Leandro wrote:

> pasman pasma=C5=84ski <pasman.p <at> gmail.com> writes:
>>=20
>> Problem solved:
>> I reinstall postgres from sources, works.
>=20
> 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 Profess=
ional
> 2002 SP3.  Will try again with the zip file, but I guess the 9.1.1 binari=
es are
> useless to me.
>=20
I am using this : http://downloads.activestate.com/ActivePerl/releases/5.14=
.1.1401/ActivePerl-5.14.1.1401-MSWin32-x86-294969.msi installer and things =
just works fine for me..
can you check if any other version of perl is in your path.
>=20
>=20
>=20
> --=20
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

--
Regards,
Sachin Srivastava
EnterpriseDB, the Enterprise PostgreSQL company.

Re: BUG #6204: Using plperl functions generate crash

From
John R Pierce
Date:
On 10/10/11 11:41 AM, Sachin Srivastava wrote:
> I am using this :
> http://downloads.activestate.com/ActivePerl/releases/5.14.1.1401/ActivePerl-5.14.1.1401-MSWin32-x86-294969.msi
installer 
> and things just works fine for me..
> can you check if any other version of perl is in your path.

whats important is what perl is in the POSTGRES SERVICE's path, not your
desktop users.   windows doesn't make this easy to determine.



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast

Re: BUG #6204: Using plperl functions generate crash

From
Guimarães Faria Corcete DUTRA, Leandro
Date:
2011/10/10 John R Pierce <pierce@hogranch.com>:
>
> whats important is what perl is in the POSTGRES SERVICE's path, not your
> desktop users.   windows doesn't make this easy to determine.

In principle I do not have any other perl installation anymore in that
machine, nor in another one exhibiting the same symptoms.  But I will
double-check.


Re: BUG #6204: Using plperl functions generate crash

From
Shahaf
Date:
I'm running into the same issue.  I can "create language plperl;"
successfully, but as soon as I try to create a function (as shown above),
Postgres dies.

Guimaraes - did you find a solution using standard installers?
sachin - have you tried on win7?
pasman - what's the process to install from source?

More detail on my setup...

I'm on Win7.

Postgres 9.1 32-bit:
http://www.enterprisedb.com/products/pgdownload.do#windows (version 9.1.2-1)

Perl 5.14 32-bit, I've tried both:
http://downloads.activestate.com/ActivePerl/releases/5.14.2.1402/ActivePerl-5.14.2.1402-MSWin32-x86-295342.msi
http://downloads.activestate.com/ActivePerl/releases/5.14.1.1401/ActivePerl-5.14.1.1401-MSWin32-x86-294969.msi

Here's what I see in the log file:

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.


--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-6204-Using-plperl-functions-generate-crash-tp4802111p5092359.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

Re: BUG #6204: Using plperl functions generate crash

From
l
Date:
Shahaf wrote
>=20
> I'm running into the same issue.  I can "create language plperl;"
> successfully, but as soon as I try to create a function (as shown above),
> Postgres dies.
>=20
> Guimaraes - did you find a solution using standard installers?
>=20

No, I didn=E2=80=99t.  In fact, =C3=BEanks God I did not have to insist on =
trying to make
=C3=B0e MS Windows aberration work for me.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-6=
204-Using-plperl-functions-generate-crash-tp4802111p5092951.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

Re: BUG #6204: Using plperl functions generate crash

From
Simon Willett
Date:
I'm running into the same issue here.

After install postgresql 9.1.2 and Activestate perl 5.14.2 execute:
create function perl_test() returns void as
$$
$$
language plperl

Generates server crash.

PostgreSQL version string: PostgreSQL 9.1.2, compiled by Visual C++ build
1500, 32 bit - Enterprise DB download
ActiveState version string: This is perl 5, version 14, subversion 2
(v5.14.2) built for MSWin32-x86-multi-thread

Is there a recommended way to solve this issue, has it been fixed in a later
release?

Simon Willett



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-6204-Using-plperl-functions-generate-crash-tp4802111p5629612.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

Re: BUG #6204: Using plperl functions generate crash

From
Robert Haas
Date:
On Tue, Apr 10, 2012 at 7:01 AM, Simon Willett <simonw@gbitsystems.co.uk> wrote:
> I'm running into the same issue here.
>
> After install postgresql 9.1.2 and Activestate perl 5.14.2 execute:
> create function perl_test() returns void as
> $$
> $$
> language plperl
>
> Generates server crash.
>
> PostgreSQL version string: PostgreSQL 9.1.2, compiled by Visual C++ build
> 1500, 32 bit - Enterprise DB download
> ActiveState version string: This is perl 5, version 14, subversion 2
> (v5.14.2) built for MSWin32-x86-multi-thread
>
> Is there a recommended way to solve this issue, has it been fixed in a later
> release?

The previous discussion seems to indicate that it's caused by using
the wrong version of Perl.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: BUG #6204: Using plperl functions generate crash

From
ljwilson
Date:
I began testing PostgreSQL 9.1.x last week, and came across this issue.
Repeatable under the following scenarios (all 32-bit)

1. Windows XP SP3 with latest updates.
2. Windows 7 SP1 with latest updates.
3. Any flavor of Perl 5.1.4.x (I've tried strawberry-perl-5.14.2.1-32bit,
ActivePerl-5.14.2.1402-MSWin32-x86-295342, and compiled my own for 5.14.0,
5.14.1, and 5.14.2)
4. postgresql-9.1.0-windows, postgresql-9.1.1-windows,
postgresql-9.1.2-windows, and postgresql-9.1.3-windows from the one-click
installers.
5. Compiled postgresql-9.1.3 from source using Windows Platform SDK 7.0.

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").

My MSVCR90.DLL versions (size)
9.0.21022.8 (655,872 bytes)
9.0.30729.1 (655,872 bytes)
9.0.30729.4148 (653,120 bytes)
9.0.30729.6161 (653,136 bytes)

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.

I'd be glad to post the plperl.dll (160,324 bytes) that works for me if
there is a proper place for this kind of thing. Or just compile it from
source yourself using the mingw instructions at
http://www.postgresql.org/docs/9.1/static/installation-platform-notes.html#INSTALLATION-NOTES-MINGW

...jack



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-6204-Using-plperl-functions-generate-crash-tp4802111p5651759.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

Re: BUG #6204: Using plperl functions generate crash

From
Simon Willett
Date:
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.
>

This is really good news.
Thank you.

.... Simon

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-6204-Using-plperl-functions-generate-crash-tp4802111p5652595.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

Re: BUG #6204: Using plperl functions generate crash

From
ljwilson
Date:
Follow-up:

Putting in debug stubs for the plperl.c source from PostgreSQL 9.1.3 I've
determined the crash mentioned in the first post of this thread occurs at
line 905:
if (SvTRUE(ERRSV))

Googling I found this:

http://www.perlmonks.org/?node_id=870835

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.

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-6204-Using-plperl-functions-generate-crash-tp4802111p5654505.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.