Re: [HACKERS] Fix for segfault in plpython's exception handling

2016-12-12 Thread Rafa de la Torre
For the record: I tested the patch by Tom Lane in our setup (python 2.7.3-0ubuntu3.8) and works like a charm. https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=9cda81f0056ca488dbd6cded64db1238aed816b2 Also in 9.5 and 9.6 series. My request in commitfest queue can be closed. Cheers!

Re: [HACKERS] Fix for segfault in plpython's exception handling

2016-12-12 Thread Rafa de la Torre
Thank you! Glad to see that the report was useful. On Fri, Dec 9, 2016 at 9:33 PM, Tom Lane wrote: > I wrote: > > Rafa de la Torre writes: > >> exc = PyErr_NewException(exception_map[i].name, base, > dict); > >> +Py_INCREF(exc); > >> PyModule_AddObject(mod,

Re: [HACKERS] Fix for segfault in plpython's exception handling

2016-12-09 Thread Tom Lane
I wrote: > Rafa de la Torre writes: >> exc = PyErr_NewException(exception_map[i].name, base, dict); >> +Py_INCREF(exc); >> PyModule_AddObject(mod, exception_map[i].classname, exc); > Hm. Seems like if this is a problem, the code for the other three > excepti

Re: [HACKERS] Fix for segfault in plpython's exception handling

2016-12-09 Thread Tom Lane
Rafa de la Torre writes: > exc = PyErr_NewException(exception_map[i].name, base, dict); > + Py_INCREF(exc); > PyModule_AddObject(mod, exception_map[i].classname, exc); Hm. Seems like if this is a problem, the code for the other three exceptions is being a

[HACKERS] Fix for segfault in plpython's exception handling

2016-12-09 Thread Rafa de la Torre
The patch attached (a one-liner) includes information about how to reproduce the issue and why it happens. We applied it to our production servers (9.5) and has been working as expected for a while. I've also checked that it can be applied cleanly to current master. Could it make its way into mas