Re: signal handling in plpython

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mario De Frutos Dieguez <mariodefrutos(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: signal handling in plpython
Date: 2016-10-14 13:05:57
Message-ID: 7672.1476450357@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Py_AddPendingCall is safe to call from a signal handler? That would
> be ... quite remarkable.

I think that a much safer way to proceed would be, rather than asking
"how can I mess with the signal handlers", asking "how can I make my
python code act like it is sprinkled with CHECK_FOR_INTERRUPTS calls".

After some perusing of the Python docs I think it might be possible to
do this by setting up a trace function (cf Py_tracefunc()) that returns
a Python error condition if InterruptPending && (QueryCancelPending ||
ProcDiePending) is true.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2016-10-14 13:17:33 Re: signal handling in plpython
Previous Message Christoph Berg 2016-10-14 12:58:33 Re: Renaming of pg_xlog and pg_clog