-
Notifications
You must be signed in to change notification settings - Fork 314
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
psysh appears to (c)lose mysqli connection #677
Comments
I put together a minimal CLI script illustrating the issue.
|
Also:
|
Try disabling forking ( |
Yep, confirmed with your repro script. It seems like mysqli doesn't play nice with forking. It's probably that one of the other threads automatically cleaned up the connection while the main thread wasn't looking? I've also confirmed that disabling pcntl via the psysh config fixes your issue. |
That's it. I can make the same happen, with no psysh in the loop, by opening a connection, forking, using it in children processes and exiting. After the first child terminates, the connection becomes useless for evey other process in the group (parent or child). I get "Mysql has gone away", not "couldn't fetch mysqli" but I think the root cause is the same. Mysql documentation mentions terminating connections on client exit, which could be the cause. I searched to see if signals are involved and, if so, ways to trap them before mysql gets wind of them, but no luck. |
Updated the Troubleshooting page of the wiki. I'm not sure what else we can do with it from our end, especially since the error happens after the shell exits? ¯_(ツ)_/¯ |
Greetings.
Using psysh v10.8 (great job BTW) to break in a moodle module I am developing. It appears that this causes the mysqli connection to go away in a semi-random fashion (meaning moving breaks around results in different outcomes).
The diagnostic is:
Couldn't fetch mysqli in [...]/lib/dml/mysqli_native_moodle_database.php
This error is always present at exit, but it does also appear during program execution depending on the breakpoint(s) location (and just before errors, $DB->mysqli->ping() returns indeed false).
I use ^D to get out of a breakpoint and continue execution, and I am speculating that the destructor for the global $DB object is called when i do that (the destructor calls mysqli->close()).
Is that what I am seeing, and if so, can it be avoided?
The text was updated successfully, but these errors were encountered: