-
Notifications
You must be signed in to change notification settings - Fork 1
Plpy interrupt #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
INT signals received when python code is not being executed affected code executed later.
The previous signal handler should always be restore upon module clean up. Note that a null pointer may be a valid handler specifier (SIG_DFL actually). We rely on _PG_fini calls being always paired with _PG_init. Note also that as of PostgreSQL 9.6 _PG_init isn't actually called ever (modules are never unloaded).
Returning 0 from the pending call function has the effect of not raising errors immediately. We must return -1 to make sure any errors are trapped in the current context.
Make sure Python exceptions occur in the context where the SIGINT occured
Two main improvements here:
Also minor fixes for correctness that affect none of CARTO operations to support SIG_DFL, SIG_IGN signal handler. |
Glad you find a way to improve this patch. Great work, looks great for me :))))) |
Remove unnecessary remnants from previous tests: * No need to keep track of plpython context nesting level * No need to pass arguments to the python pending call
while trying to generate the package from the sources:
I'll try to get it fixed. |
See CartoDB/postgres#5 and more specifically the commit b319cee
It should be soon available for testing here: https://launchpad.net/~cartodb/+archive/ubuntu/postgresql-next |
@azamorano or @jvillarf can you please take a look? |
@jgoizueta one last check? |
👍 I've checked the effect of the final patch and it matches the intended code, which I've also updated in CartoDB/postgres#5 (it had some extraneous characters there as @ethervoid had noticed). Thanks for taking care of this! |
Some fixes and enhancements for more reliable plpython execution interruption.