Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMuUM-0007vM-CB for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Feb 2022 16:27:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nMuUL-0007Sg-60 for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Feb 2022 16:27:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMuUK-0007SX-Ts for pgsql-bugs@lists.postgresql.org; Wed, 23 Feb 2022 16:27:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMuUI-00007c-2D for pgsql-bugs@lists.postgresql.org; Wed, 23 Feb 2022 16:27:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 21NGRU1e1048492; Wed, 23 Feb 2022 11:27:30 -0500 From: Tom Lane To: exclusion@gmail.com cc: Peter Eisentraut , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17416: Server crashes due to python3 stack overflow on executing multiple plpy.rollback() calls In-reply-to: <17416-ed8fe5d7213d6c25@postgresql.org> References: <17416-ed8fe5d7213d6c25@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 23 Feb 2022 11:00:01 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1048490.1645633650.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 23 Feb 2022 11:27:30 -0500 Message-ID: <1048491.1645633650@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > When executing the following script: > psql -c " > CREATE EXTENSION plpython3u; > CREATE FUNCTION plpy_xact_test() RETURNS int > LANGUAGE plpython3u > AS ' > plpy.rollback() > return 1 > '" > for i in `seq 500`; do echo "SELECT plpy_xact_test();"; done | psql > I get the server crash with the following stack trace: Interesting. For me, 500 repetitions won't crash it, but 1000 will. Apparently, each escape out of plpy.rollback leaves an open frame on Python's internal control stack, and eventually it barfs. So this is a different way to reach the problems already under investigation at [1]. You don't really need a bleeding-edge Python at all. regards, tom lane [1] https://www.postgresql.org/message-id/flat/3375ffd8-d71c-2565-e348-a59= 7d6e739e3@enterprisedb.com