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
Restructure content process shutdown ack with threaded sender #23972
Restructure content process shutdown ack with threaded sender #23972
Conversation
Heads up! This PR modifies the following files:
|
This is another recycled commit from the big ipc experiment over at #23909 In this case, it restructures the "wait for content to shutdown" pattern, in the following way:
@asajeffrey r? |
r? @asajeffrey |
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 a bit confused by these changes. Replacing an IPC channel by a crossbeam channel IO can understand, since the channel never leaves the process. But AFAICT the channel is being used as a latch, we're never actually sending a message on it?
components/constellation/pipeline.rs
Outdated
let signal = content_process_shutdown_port.recv(); | ||
// When the script-thread drops the sender, | ||
// we expect to receive an Err(_). | ||
assert!(signal.is_err()); |
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.
Perhaps an error!
log rather than a panic?
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.
Oh yeah, forgot this is in the constellation thread...
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.
It's not in the constellation thread actually, but I guess an error is better.
components/constellation/pipeline.rs
Outdated
let signal = content_process_shutdown_port.recv(); | ||
// When the script-thread drops the sender, | ||
// we expect to receive an Err(_). | ||
assert!(signal.is_err()); |
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 confused about who sends on this channel, since the only uses of send(())
appear to have been deleted. Are we using a channel just for its Drop
implementation?
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.
Yes, previously there was an explicit sending of a message when the script-thread exits, which I can bring back if you think that's clearer. Or we can effectively wait until the channel drops, and assert it is indeed the Err
that would be received in such a case.
I think we can count on the channel not sending any spurious errors.
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.
Actually, I think you're right it's better to send an explicit message, since the drop could also be the result of an unexpected shutdown of the script-thread, while a message will almost always mean there was a graceful shutdown...
components/script/script_thread.rs
Outdated
@@ -744,6 +744,7 @@ impl ScriptThreadFactory for ScriptThread { | |||
thread_state::initialize(ThreadState::SCRIPT); | |||
PipelineNamespace::install(state.pipeline_namespace_id); | |||
TopLevelBrowsingContextId::install(state.top_level_browsing_context_id); | |||
|
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.
Don't think we need a new blank line :)
afc6480
to
4cd2730
Compare
Ok, comments addressed @asajeffrey |
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.
OK, a question, but otherwise LGTM.
@@ -545,6 +530,7 @@ impl UnprivilegedPipelineContent { | |||
self.script_chan.clone(), | |||
self.load_data.url.clone(), | |||
); | |||
let (content_process_shutdown_chan, content_process_shutdown_port) = unbounded(); |
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.
Should this be unbounded or a one-shot channel?
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 not aware of crossbeam having a dedicated one-shot variant.
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 meant bounded(1)
.
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.
for what reason?
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.
Possible space efficiency, but it probably doesn't matter that much.
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 see what you mean, counterintuitively, the unbounded variant appears to require less bookkeeping than the bounded variant.
@bors-servo r+ |
📌 Commit 4cd2730 has been approved by |
… r=asajeffrey Restructure content process shutdown ack with threaded sender Recycling some work from #23909 <!-- Please describe your changes on the following line: --> --- <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23972) <!-- Reviewable:end -->
💔 Test failed - status-taskcluster |
4cd2730
to
8482d2e
Compare
@asajeffrey Ok that was |
@bors-servo r+ |
📌 Commit 8482d2e has been approved by |
… r=asajeffrey Restructure content process shutdown ack with threaded sender Recycling some work from #23909 <!-- Please describe your changes on the following line: --> --- <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23972) <!-- Reviewable:end -->
💔 Test failed - status-taskcluster |
@bors-servo retry seems like a taskcluster error: |
💣 Failed to start rebuilding: |
… r=asajeffrey Restructure content process shutdown ack with threaded sender Recycling some work from #23909 <!-- Please describe your changes on the following line: --> --- <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23972) <!-- Reviewable:end -->
☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster |
Recycling some work from #23909
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is