plpython issue with Win64 (PG 9.2)

From: Asif Naeem <asif(dot)naeem(at)enterprisedb(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: plpython issue with Win64 (PG 9.2)
Date: 2012-06-27 09:51:20
Message-ID: CACDUQd_F3Y8QCy02pP1da-3-vqLrs0kzZJ3J0x2hgixqb4BECg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Windows 7 64bit, plpython is causing server crash with the following
test case i.e.

CREATE PROCEDURAL LANGUAGE 'plpython3u';
> CREATE OR REPLACE FUNCTION pymax (a integer, b integer)
> RETURNS integer
> AS $$
> if a > b:
> return a
> return b
> $$ LANGUAGE plpython3u;
> SELECT pymax(1, 2);

Server exit with the following exception i.e.

Unhandled exception at 0x777a3483 in postgres.exe: 0xC00000FD: Stack
overflow.

plpython3.dll!PLy_traceback(char * * xmsg, char * * tbmsg, int *
tb_depth) Line 174 C
plpython3.dll!PLy_elog(int elevel, const char * fmt, ...) Line 67
C
plpython3.dll!PLyUnicode_AsString(_object * unicode) Line 96 C
plpython3.dll!PLy_traceback(char * * xmsg, char * * tbmsg, int *
tb_depth) Line 176 + 0x8 bytes C
plpython3.dll!PLy_elog(int elevel, const char * fmt, ...) Line 67
C
plpython3.dll!PLyUnicode_AsString(_object * unicode) Line 96 C
...
...
plpython3.dll!PLy_traceback(char * * xmsg, char * * tbmsg, int *
tb_depth) Line 176 + 0x8 bytes C
plpython3.dll!PLy_elog(int elevel, const char * fmt, ...) Line 67
C
plpython3.dll!PLyUnicode_AsString(_object * unicode) Line 96 C
plpython3.dll!PLy_traceback(char * * xmsg, char * * tbmsg, int *
tb_depth) Line 176 + 0x8 bytes C

Dbserver get stuck in the following call loop i.e.
... PLy_elog() -> PLy_traceback() -> PLyUnicode_AsString() ->
PLyUnicode_Bytes() -> PLy_elog() ...

I think primary reason that trigger this issue is when Function
PLyUnicode_Bytes() calls "PyUnicode_AsEncodedString( ,WIN1252 /*Server
encoding*/, ) " it fails with null. I built latest pg 9.2 source code with
python 3.2.2.3 by using Visual Studio 2010. Thanks.

Best Regards,
Muhammad Asif Naeem

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nils Goroll 2012-06-27 10:10:47 Re: experimental: replace s_lock spinlock code with pthread_mutex on linux
Previous Message Amit Kapila 2012-06-27 09:33:00 Re: new --maintenance-db options