Considering signal handling in plpython again
От | Hubert Zhang |
---|---|
Тема | Considering signal handling in plpython again |
Дата | |
Msg-id | CAB0yrek0C9ioVoaTiPUXy4GKzHxuf8aSc3+krCCSK_Emxwf4nQ@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Considering signal handling in plpython again
|
Список | pgsql-hackers |
Hi all,
I want to support canceling for a plpython query which may be a busy loop.
I found some discussions on pgsql-hackers 2 years ago. Below is the link.
--
Mario wrote a patch to fix this problem at that time
The main logic is to register a new signal handler for SIGINT/SIGTERM
and link the old signal handler in the chain.
static void PLy_python_interruption_handler() | |
{ | |
PyErr_SetString(PyExc_RuntimeError, "test except"); | |
return NULL; | |
} | |
static void | |
PLy_handle_interrupt(int sig) | |
{ | |
// custom interruption | |
int added = Py_AddPendingCall(PLy_python_interruption_handler, NULL); | |
if (coreIntHandler) { | |
(*coreIntHandler)(sig); | |
} | |
} |
Does anyone have some comments on this patch?
As for me, I think handler function should call PyErr_SetInterrupt() instead of PyErr_SetString(PyExc_RuntimeError, "test except");
Thanks
Hubert Zhang
В списке pgsql-hackers по дате отправления: