pltcl crashes due to a syntax error - Mailing list pgsql-hackers

From a.kozhemyakin
Subject pltcl crashes due to a syntax error
Date
Msg-id 6a2a1c40-2b2c-4a33-8b72-243c0766fcda@postgrespro.ru
Whole thread Raw
Responses Re: pltcl crashes due to a syntax error
Re: pltcl crashes due to a syntax error
List pgsql-hackers
Hello hackers,

When executing the following query on master branch:

CREATE EXTENSION pltcl;
CREATE or replace PROCEDURE test_proc5(INOUT a text)
         LANGUAGE pltcl
         AS $$
         set aa [concat $1 "+" $1]
         return [list $aa $aa])
         $$;

CALL test_proc5('abc');
CREATE EXTENSION
CREATE PROCEDURE
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.

The connection to the server was lost. Attempting reset: Failed.


Core was generated by `postgres: postgres postgres [loca'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142
142     ../sysdeps/x86_64/multiarch/strlen-sse2.S: No such file or 
directory.
(gdb) bt
#0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142
#1  0x00007f5f1353ba6a in utf_u2e (src=0x0) at pltcl.c:77
#2  0x00007f5f1353c9f7 in throw_tcl_error (interp=0x55ec24bdaf70, 
proname=0x55ec24b6b140 "test_proc5") at pltcl.c:1373
#3  0x00007f5f1353ed64 in pltcl_func_handler 
(fcinfo=fcinfo@entry=0x7ffdbfb407a0, 
call_state=call_state@entry=0x7ffdbfb405d0, 
pltrusted=pltrusted@entry=true) at pltcl.c:1029
#4  0x00007f5f1353ee8d in pltcl_handler (fcinfo=0x7ffdbfb407a0, 
pltrusted=pltrusted@entry=true) at pltcl.c:765
#5  0x00007f5f1353f1ef in pltcl_call_handler (fcinfo=<optimized out>) at 
pltcl.c:698
#6  0x000055ec239ec64a in ExecuteCallStmt 
(stmt=stmt@entry=0x55ec24a9a940, params=params@entry=0x0, 
atomic=atomic@entry=false, dest=dest@entry=0x55ec24a6ea18) at 
functioncmds.c:2285
#7  0x000055ec23c103a7 in standard_ProcessUtility (pstmt=0x55ec24a9a9d8, 
queryString=0x55ec24a99e68 "CALL test_proc5('abc');", 
readOnlyTree=<optimized out>, context=PROCESS_UTILITY_TOPLEVEL, 
params=0x0, queryEnv=0x0, dest=0x55ec24a6ea18,
     qc=0x7ffdbfb40f40) at utility.c:851
#8  0x000055ec23c1081b in ProcessUtility 
(pstmt=pstmt@entry=0x55ec24a9a9d8, queryString=<optimized out>, 
readOnlyTree=<optimized out>, 
context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=<optimized out>, 
queryEnv=<optimized out>,
     dest=0x55ec24a6ea18, qc=0x7ffdbfb40f40) at utility.c:523
#9  0x000055ec23c0e04e in PortalRunUtility 
(portal=portal@entry=0x55ec24b18108, pstmt=0x55ec24a9a9d8, 
isTopLevel=isTopLevel@entry=true, 
setHoldSnapshot=setHoldSnapshot@entry=true, 
dest=dest@entry=0x55ec24a6ea18, qc=qc@entry=0x7ffdbfb40f40)
     at pquery.c:1158
#10 0x000055ec23c0e3b7 in FillPortalStore 
(portal=portal@entry=0x55ec24b18108, isTopLevel=isTopLevel@entry=true) 
at pquery.c:1031
#11 0x000055ec23c0e6ee in PortalRun (portal=portal@entry=0x55ec24b18108, 
count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, 
run_once=run_once@entry=true, dest=dest@entry=0x55ec24a9aec8, 
altdest=altdest@entry=0x55ec24a9aec8,
     qc=0x7ffdbfb41130) at pquery.c:763
#12 0x000055ec23c0acca in exec_simple_query 
(query_string=query_string@entry=0x55ec24a99e68 "CALL 
test_proc5('abc');") at postgres.c:1274
#13 0x000055ec23c0caad in PostgresMain (dbname=<optimized out>, 
username=<optimized out>) at postgres.c:4680
#14 0x000055ec23c0687a in BackendMain (startup_data=<optimized out>, 
startup_data_len=<optimized out>) at backend_startup.c:105
#15 0x000055ec23b766bf in postmaster_child_launch 
(child_type=child_type@entry=B_BACKEND, 
startup_data=startup_data@entry=0x7ffdbfb41354 "", 
startup_data_len=startup_data_len@entry=4, 
client_sock=client_sock@entry=0x7ffdbfb41390)
     at launch_backend.c:265
#16 0x000055ec23b7ab36 in BackendStartup 
(client_sock=client_sock@entry=0x7ffdbfb41390) at postmaster.c:3593
#17 0x000055ec23b7adb0 in ServerLoop () at postmaster.c:1674
#18 0x000055ec23b7c20c in PostmasterMain (argc=argc@entry=3, 
argv=argv@entry=0x55ec24a54030) at postmaster.c:1372
#19 0x000055ec23aacf9f in main (argc=3, argv=0x55ec24a54030) at main.c:197




pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Add memory context type to pg_backend_memory_contexts view
Next
From: Alexander Lakhin
Date:
Subject: Re: ResourceOwner refactoring