Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wUUIj-001C3Z-0Q for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Jun 2026 18:57:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wUUIi-00Fgiw-06 for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Jun 2026 18:57:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wUKxn-00DoRx-0P for pgsql-bugs@lists.postgresql.org; Tue, 02 Jun 2026 08:59:07 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wUKxl-00000000ifS-0YZq for pgsql-bugs@lists.postgresql.org; Tue, 02 Jun 2026 08:59:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=JQoX7kwYoHFLA2KYP+KH70WnEAyGnEQnyJb1BGjvsKw=; b=Nw9qQC2Xag/E4dZX/PqA9oIur2 +p/Sil/XSrczhuCJUcwpPipxMwfMMo9NGsHNTdWdTfZyUBtwV5dDjXGG8AlrpsnTzqMBOUzrRh61g 8C2ytMk58Lyd78JqLvwT+SgKwDold7aUxdCuAspd28DnkjRPcMetmkXfXOFKo+faUNYdTfwXdqksg KSOORQFuvGu5AcmvB6TzDW32KH2+lgrclhzmvaNZxS8DADzQyKw+tVJ3DI9uaSoOzUGJMzc+L/BjY MSjixfimZb8c96UW2PerlKX2X7iybqnC92uHImyyPLou97kJmPax/XGB8YAU0pl3DqvUcQyd0bltF tERnaIpA==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wUKxk-002EGm-2Z for pgsql-bugs@lists.postgresql.org; Tue, 02 Jun 2026 08:59:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wUKxj-004vys-0I for pgsql-bugs@lists.postgresql.org; Tue, 02 Jun 2026 08:59:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19504: Segmentation fault in plpython3u function (pg19) To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: rekgrpth@gmail.com Reply-To: rekgrpth@gmail.com, pgsql-bugs@lists.postgresql.org Date: Tue, 02 Jun 2026 08:58:26 +0000 Message-ID: <19504-38cee6d64aa466e0@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19504 Logged by: RekGRpth Email address: rekgrpth@gmail.com PostgreSQL version: 18.4 Operating system: docker alpine 3.23 Description: =20 ```sql CREATE LANGUAGE plpython3u; CREATE OR REPLACE FUNCTION f() RETURNS text AS $$ import ctypes postgres =3D ctypes.CDLL(None) pchomp =3D postgres['pchomp'] # pchomp.restype =3D ctypes.c_char_p return ctypes.cast(pchomp("error\n"), ctypes.c_char_p).value $$ LANGUAGE plpython3u; SELECT f(); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. ``` ``` #0 0x00007a0662f4a104 in strlen (s=3D) at src/string/strlen.c:17 #1 0x00007a063a5e6947 in ?? () from /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-musl.so #2 0x00007a063a92a7a3 in _PyObject_GenericGetAttrWithDict () from /usr/lib/libpython3.12.so.1.0 #3 0x00007a063a929c7f in PyObject_GetAttr () from /usr/lib/libpython3.12.so.1.0 #4 0x00007a063a9d44ff in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.12.so.1.0 #5 0x00007a063a9db321 in PyEval_EvalCode () from /usr/lib/libpython3.12.so.1.0 #6 0x00007a063af9d0fb in PLy_procedure_call (proc=3D0x7a063a68bd90, kargs=3D0x7a063afa9912 "args", vargs=3D0x7a063af38a40) at plpy_exec.c:1111 #7 0x00007a063af99990 in PLy_exec_function (fcinfo=3D0x7a063a6213a8, proc=3D0x7a063a68bd90) at plpy_exec.c:103 #8 0x00007a063af9db69 in plpython3_call_handler (fcinfo=3D0x7a063a6213a8) = at plpy_main.c:202 #9 0x000058e1b6a2260b in ExecEvalFuncExprFusage (state=3D0x7a063a621250, op=3D0x7a063a621970, econtext=3D0x7a063a620ef8) at execExprInterp.c:3002 #10 0x000058e1b6a1e7d4 in ExecInterpExpr (state=3D0x7a063a621250, econtext=3D0x7a063a620ef8, isnull=3D0x0) at execExprInterp.c:1014 #11 0x000058e1b6a21188 in ExecInterpExprStillValid (state=3D0x7a063a621250, econtext=3D0x7a063a620ef8, isNull=3D0x0) at execExprInterp.c:2301 #12 0x000058e1b6a894e6 in ExecEvalExprNoReturn (state=3D0x7a063a621250, econtext=3D0x7a063a620ef8) at ../../../src/include/executor/executor.h:426 #13 0x000058e1b6a895a4 in ExecEvalExprNoReturnSwitchContext (state=3D0x7a063a621250, econtext=3D0x7a063a620ef8) at ../../../src/include/executor/executor.h:467 #14 0x000058e1b6a89605 in ExecProject (projInfo=3D0x7a063a621248) at ../../../src/include/executor/executor.h:499 #15 0x000058e1b6a89824 in ExecResult (pstate=3D0x7a063a620de8) at nodeResult.c:135 #16 0x000058e1b6a3c4ff in ExecProcNodeInstr (node=3D0x7a063a620de8) at execProcnode.c:486 #17 0x000058e1b6a3c4d0 in ExecProcNodeFirst (node=3D0x7a063a620de8) at execProcnode.c:470 #18 0x000058e1b6a2da3b in ExecProcNode (node=3D0x7a063a620de8) at ../../../src/include/executor/executor.h:320 #19 0x000058e1b6a30aa5 in ExecutePlan (queryDesc=3D0x7a0662536bb0, operation=3DCMD_SELECT, sendTuples=3Dtrue, numberTuples=3D0, direction=3DForwardScanDirection, dest=3D0x7a063a623e58) at execMain.c:1727 #20 0x000058e1b6a2e0ed in standard_ExecutorRun (queryDesc=3D0x7a0662536bb0, direction=3DForwardScanDirection, count=3D0) at execMain.c:368 #21 0x00007a0662035bf1 in explain_ExecutorRun (queryDesc=3D0x7a0662536bb0, direction=3DForwardScanDirection, count=3D0) at auto_explain.c:387 #22 0x00007a0662024034 in pgss_ExecutorRun (queryDesc=3D0x7a0662536bb0, direction=3DForwardScanDirection, count=3D0) at pg_stat_statements.c:1034 #23 0x00007a0662012346 in pgsk_ExecutorRun (queryDesc=3D0x7a0662536bb0, direction=3DForwardScanDirection, count=3D0) at pg_stat_kcache.c:1093 #24 0x00007a06620041d5 in pgqs_ExecutorRun (queryDesc=3D0x7a0662536bb0, direction=3DForwardScanDirection, count=3D0) at pg_qualstats.c:677 #25 0x00007a0661ff1d1f in pgws_ExecutorRun (queryDesc=3D0x7a0662536bb0, direction=3DForwardScanDirection, count=3D0) at pg_wait_sampling.c:1052 #26 0x000058e1b6a2df38 in ExecutorRun (queryDesc=3D0x7a0662536bb0, direction=3DForwardScanDirection, count=3D0) at execMain.c:303 #27 0x000058e1b6d6e3de in PortalRunSelect (portal=3D0x7a063b2a2d50, forward=3Dtrue, count=3D0, dest=3D0x7a063a623e58) at pquery.c:916 #28 0x000058e1b6d6e017 in PortalRun (portal=3D0x7a063b2a2d50, count=3D9223372036854775807, isTopLevel=3Dtrue, dest=3D0x7a063a623e58, altdest=3D0x7a063a623e58, qc=3D0x7fffc568e7f0) at pquery.c:760 #29 0x000058e1b6d664af in exec_simple_query (query_string=3D0x7a06624ef4a0 "SELECT f();") at postgres.c:1288 #30 0x000058e1b6d6bfcf in PostgresMain (dbname=3D0x7a0661ec0b90 "postgres", username=3D0x7a0662acf020 "postgres") at postgres.c:4840 #31 0x000058e1b6d616ee in BackendMain (startup_data=3D0x7fffc568eaa0, startup_data_len=3D24) at backend_startup.c:124 #32 0x000058e1b6c4d9ad in postmaster_child_launch (child_type=3DB_BACKEND, child_slot=3D1, startup_data=3D0x7fffc568eaa0, startup_data_len=3D24, client_sock=3D0x7fffc568eb00) at launch_backend.c:268 #33 0x000058e1b6c54711 in BackendStartup (client_sock=3D0x7fffc568eb00) at postmaster.c:3630 #34 0x000058e1b6c51b3d in ServerLoop () at postmaster.c:1722 #35 0x000058e1b6c5142c in PostmasterMain (argc=3D1, argv=3D0x7a0662d34a00) = at postmaster.c:1412 #36 0x000058e1b6ad0b51 in main (argc=3D1, argv=3D0x7a0662d34a00) at main.c:= 231 ```