-
Notifications
You must be signed in to change notification settings - Fork 208
PHPC-1274: Do not allow forked children to affect parent resources #1059
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
@@ -0,0 +1,102 @@ | |||
--TEST-- | |||
PHPC-1274: Session destruct should not end session from parent process |
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.
This is currently not functioning as a regression test, as I'm having trouble getting the child process to actually kill the session when it exits if I disable the call to mongoc_client_reset()
in the Session's free_object
handler.
I think this may be because the session pool is really only destroyed during the call to mongoc_client_destroy()
, and PHPC purposefully avoids calling that due to 600db56 (PHPC-912). If that's the case, perhaps we can't implement a regression test for this at all and will have to make do with the "does not abort" test.
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.
I'd like to leave this test in place despite my last comment, as it could become more relevant when we get to PHPC-1522. And even if we can't implement that (i.e. allow children to call mongoc_client_destroy()
on clients created by parents), this may still be useful as our only test to demonstrate that child processes don't kill active sessions of a parent process.
6d05ac6
to
58fc57c
Compare
Reset logic looks sound to me. LGTM once |
Check PID before creating/freeing a session or cursor to avoid interfering with resources owned by a parent process. Additionally, prohibit resetting a client multiple times to avoid cases where child resources may not be cleaned up.
https://jira.mongodb.org/browse/PHPC-1274
This PR will supersede both #941 and #1027