Re: BUG #17416: Server crashes due to python3 stack overflow on executing multiple plpy.rollback() calls

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: exclusion(at)gmail(dot)com
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17416: Server crashes due to python3 stack overflow on executing multiple plpy.rollback() calls
Date: 2022-02-23 16:27:30
Message-ID: 1048491.1645633650@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> 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-a597d6e739e3(at)enterprisedb(dot)com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Anurag Shrivastava 2022-02-24 14:21:41 Wal sender process not moving past wait_event_type: IO and wait_event: WALRead
Previous Message Tom Lane 2022-02-23 15:59:00 Re: BUG #17415: Unable to use underscore as first character in set_config custom parameter