-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-12974: Apache crashes on shutdown when using pg_pconnect() #13032
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
On ZTS, the global variables are stored in dynamically allocated memory. When the module gets shut down this memory is released. After the module is shut down, only then are the persistent resources cleared. Normally this isn't an issue, but pgsql and odbc refer to the globals to modify some counters, after the globals have been freed. Fix this by guarding the modification.
Looking good ; I noticed oci8 seems to have a similar issue (php_oci_pconnection_list_dtor), up to you if yo wanna update in this PR. |
Updated. (also fixed a syntax mistake in NTS, oops) |
Actually looks like oci8 is a little bit more difficult because it accesses the globals in functions that are transitively called too... And also in macros (e.g. PHP_OCI_CALL) Not too sure what clean way to fix it there. |
gotcha, preferably it would be nice to have odbc/pgsql fixd for the next release, we can always come back to oci8 later if it takes time. |
I agree, dropped oci8 change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your help.
My pleasure |
On ZTS, the global variables are stored in dynamically allocated memory. When the module gets shut down this memory is released. After the module is shut down, only then are the persistent resources cleared. Normally this isn't an issue, but pgsql and odbc refer to the globals to modify some counters, after the globals have been freed.
Fix this by guarding the modification.
We don't have Apache tests unfortunately, but I tested this manually with Valgrind (instructions in the linked issue).