-
Notifications
You must be signed in to change notification settings - Fork 488
fix: a thread that ended on its own can still be asked to shut down #2664
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
Merged
+48
−2
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
531a5ab
fix: a thread that ended on its own can still be asked to shut down
nicolas-grekas e6dc03c
test: a reboot that meets a worker giving up at boot no longer hangs …
nicolas-grekas bc7660a
chore: make the Done wait comment stand on its own
dunglas ab72f25
test: use testDataPath for the reset-then-fail worker
dunglas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?php | ||
|
|
||
| // asks for a reboot of every thread while booting, then fails before | ||
| // reaching frankenphp_handle_request() | ||
| opcache_reset(); | ||
|
|
||
| exit(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure this is a good idea. "Done" is kind of a transitionary state, meaning another thread probably is waiting for "Done" to set it to "Reserved".
Is this even necessary if #2662 is merged instead?
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.
Still needed with #2662: that one runs once
RequestSafeStateChange()has returned, this one is what lets it return. A thread still booting (TransitionComplete) that then fails on its own goesShuttingDown→Doneand never reaches a state the old wait listens to, so the caller hangs before #2662's code runs. On main that'sforceReboot()fromRestartWorkers()oropcache_reset()during startup; on #2617 it's the boot timeout, which returns frominitWorkers()while the thread is still booting.On
Donebeing transitional: the waiter only reads it and refuses, it never writes.Reservedwas already in the set, so whichever of the two it sees the answer is the same, and whoever movesDonetoReservedisn't affected.Uh oh!
There was an error while loading. Please reload this page.
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.
e6dc03c adds a test that hangs on main with it in. A worker calls
opcache_reset()while booting, then gives up. The reboot holdsscalingMuand waits inforceReboot()for the thread, which ends on its own atDone, andShutdown()queues behindscalingMu:Init()never returns. With this PR it returns the boot error in 0.1s.On main alone that's a narrow race; the stronger driver is #2617, whose boot timeout returns from
initWorkers()while the thread is still booting.