BUG #13579: Server crashes after executing plpythonu function

Started by Nonameover 10 years ago3 messagesbugs
Jump to latest
#1Noname
ppmichalakk@gmail.com

The following bug has been logged on the website:

Bug reference: 13579
Logged by: Paweł Michalak
Email address: ppmichalakk@gmail.com
PostgreSQL version: 9.4.4
Operating system: Debian 4.6.3-14
Description:

[pmichalak@asdasd ~] $ psql
psql (9.4.4)
Type "help" for help.
pmichalak=# create function a() returns setof record as $$
return { 'a': 2, 'b': 3 }
$$ language plpythonu;
CREATE FUNCTION
pmichalak=# select * from a() as (b integer, c integer);
ERROR: input of anonymous composite types is not implemented
CONTEXT: while creating return value
PL/Python function "a"
pmichalak=# select * from a() as (b integer, c integer);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

Server log:
STATEMENT: select * from a() as (b integer, c integer);
ERROR: syntax error at or near "," at character 30
STATEMENT: select * from q() as (b integer, c integer);
LOG: server process (PID 14767) was terminated by signal 11: Segmentation
fault
DETAIL: Failed process was running: select * from a() as (b integer, c
integer);
LOG: terminating any other active server processes

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: BUG #13579: Server crashes after executing plpythonu function

ppmichalakk@gmail.com writes:

pmichalak=# create function a() returns setof record as $$
return { 'a': 2, 'b': 3 }
$$ language plpythonu;
CREATE FUNCTION
pmichalak=# select * from a() as (b integer, c integer);
ERROR: input of anonymous composite types is not implemented
CONTEXT: while creating return value
PL/Python function "a"
pmichalak=# select * from a() as (b integer, c integer);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

Hm. Looks like we're trying to free already-freed memory here:

#2 0x00000000007babc9 in ExceptionalCondition (
conditionName=<value optimized out>, errorType=<value optimized out>,
fileName=<value optimized out>, lineNumber=<value optimized out>)
at assert.c:54
#3 0x00000000007dc292 in pfree (pointer=<value optimized out>) at mcxt.c:920
#4 0x00007fbde21a971f in PLy_free (ptr=<value optimized out>)
at plpy_util.c:53
#5 0x00007fbde21a7ad4 in PLy_output_tuple_funcs (arg=0x2cd2a68,
desc=0x2cdb240) at plpy_typeio.c:208
#6 0x00007fbde21a8b72 in PLy_output_record_funcs (arg=0x2cd2a68,
desc=0x2cdb240) at plpy_typeio.c:277
#7 0x00007fbde21a25df in PLy_function_build_args (fcinfo=0x7ffd7f54aa10,
proc=0x2cd2a48) at plpy_exec.c:419
#8 0x00007fbde21a279e in PLy_exec_function (fcinfo=0x7ffd7f54aa10,
proc=0x2cd2a48) at plpy_exec.c:60
#9 0x00007fbde21a3351 in plpython_call_handler (fcinfo=0x7ffd7f54aa10)
at plpy_main.c:232
#10 0x00000000005d96bb in ExecMakeTableFunctionResult (funcexpr=0x2cdaa28,
econtext=0x2cda5b8, argContext=<value optimized out>,
expectedDesc=0x2cdb240, randomAccess=0 '\000') at execQual.c:2189

Thanks for the report!

regards, tom lane

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: BUG #13579: Server crashes after executing plpythonu function

ppmichalakk@gmail.com writes:

pmichalak=# create function a() returns setof record as $$
return { 'a': 2, 'b': 3 }
$$ language plpythonu;
CREATE FUNCTION
pmichalak=# select * from a() as (b integer, c integer);
ERROR: input of anonymous composite types is not implemented
CONTEXT: while creating return value
PL/Python function "a"
pmichalak=# select * from a() as (b integer, c integer);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

Fixed, thanks for the report!

regards, tom lane

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