pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ludwig Isaac Lim <ludz_lim@yahoo.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: ERROR : cannot commit while a portal is pinned from plpython
Date: Fri, 2 Dec 2022 08:45:06 +0000 (UTC)
Message-ID: <1061909348.200334.1669970706749@mail.yahoo.com> (raw)
References: <1061909348.200334.1669970706749.ref@mail.yahoo.com>

Hello:

I noticed the following lines in my PostgreSQL log file today:

2022-12-01 14:16:54.517 UTC [10073] ERROR:  cannot commit while a portal is pinned
2022-12-01 14:16:54.517 UTC [10073] STATEMENT:  call p_annotate_db_stats()



The process ID can be traced to plpython procedure call.

What is baffling is there's no commit (or rollback) inside the stored procedure call.

The notable changes I made to the stored procedure is:

adding this block of code

try:
      --processing stuff
except:
       exc_type, exc_value, tb = sys.exc_info()
       if tb is None:
              print("No exception / traceback information", file=sys.stderr)
              sys.exit(-1)
       prev = tb
       curr = tb.tb_next
       while curr is not None:
              prev = curr
              curr = curr.tb_next
       print(prev.tb_frame.f_locals, file=sys.stderr)
       traceback.print_exception(*sys.exc_info())
       print("Exiting", file=sys.stderr)



The stored procedure is executed via psql call using the following command in bash:
  nohup psql -c "call p_annotate_db_stats()" &


Postgresql version :  PostgreSQL 14.6 on aarch64-unknown-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-15), 64-bit



Python version : Python 3.7.10

What could be the cause of the error? Thank you.



Regards,
Ludwig Lim





Message-ID: <1061909348.200334.1669970706749@mail.yahoo.com>
Permalink:  ../1061909348.200334.1669970706749@mail.yahoo.com/
Also on:    postgresql.org/message-id/1061909348.200334.1669970706749@mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ludz_lim@yahoo.com
  Subject: Re: ERROR : cannot commit while a portal is pinned from plpython
  In-Reply-To: <1061909348.200334.1669970706749@mail.yahoo.com>
  References: <1061909348.200334.1669970706749.ref@mail.yahoo.com> <1061909348.200334.1669970706749@mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox