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
Ensure clean shutdown of JS threads #27016
Conversation
Heads up! This PR modifies the following files:
|
@bors-servo try=wpt |
constellation: don't make shutdown depend on having exited all pipelines <!-- Please describe your changes on the following line: --> FIX #26685 FIX #26996 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo try=wpt |
Constellation: don't make shutdown depend on having exited all pipelines <!-- Please describe your changes on the following line: --> FIX #26685 FIX #26996 FIX #9672 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
// Randomly close a pipeline if --random-pipeline-closure-probability is set | ||
// This is for testing the hardening of the constellation. | ||
self.maybe_close_random_pipeline(); | ||
self.handle_request(); | ||
} | ||
|
||
// Try to cleanly exit all pipelines, until a timeout hits. | ||
let pipeline_exit_timeout = after(Duration::from_millis(200)); |
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.
If possible, can you make that a pref?
loop { | ||
if self.pipelines.is_empty() { | ||
break; | ||
} |
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 loop + if could be turned into a while
.
recv(pipeline_exit_timeout) -> _ => { | ||
if !self.pipelines.is_empty() { | ||
warn!("Failed to exit a number of pipelines {:?}", self.pipelines.len()); | ||
} |
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.
Is there any way to get more information about why it's blocked?
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'm afraid we will have that warning and never pay attention to it.
Maybe make it an error, or dump a stack, not sure…
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 tried sampling them via the BHM, and while it works it's a bit messy because the bhm messaging stuff is not really setup for that, I think it could potentially introduce a new hang since we don't match bhm senders to pipeline yet(so the constellation could end-up blocking on a receiver for an already exited pipeline if not careful), so perhaps best done as a follow-up, if at all.
Also someone could use the dedicated sampling API to do this manually in some way, the current changes are more aimed at ensuring the window actually closes when someone wants to close it.
Also this seems to mostly happen when JS is running and blocking the script-thread from handling the exit messages, so I think what we really need is a hook to kill the script-thread, see #27027
|
ec4d848
to
db761f3
Compare
@paulrouget r? |
Ok actually I will do this "properly" as per #27027, and remove the timeout since that doesn't actually solve the underlying problem... |
c8eaf18
to
f083da4
Compare
@bors-servo r=jdm,paulrouget |
|
Ensure clean shutdown of JS threads <!-- Please describe your changes on the following line: --> FIX #26685 FIX #26996 FIX #9672 FIX #27027 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
Ok, didn't account for worklets... |
@bors-servo r=jdm,paulrouget |
|
|
FIX #26685
FIX #26996
FIX #9672
FIX #27027
./mach build -d
does not report any errors./mach test-tidy
does not report any errors