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

Reply via email to