Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group