Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAvoid deadlock when closing a pipeline. #11585
Conversation
highfive
commented
Jun 3, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jun 3, 2016
|
cc @emilio and @larsbergstrom |
|
I note we don't have a I-deadlock or I-liveness issue :) |
|
Running test-wpt locally, I can see some new TIMEOUTs, which is probably due to not having a timeout on shutdown. The easiest thing to do would be to add a |
|
Are these FAIL->TIMEOUT or PASS->TIMEOUT? The former seems OK; the latter is worrysome. I get a little bit worried about constant, fixed timeouts, as it's easy to hit them on either slow devices or devices that are, say, building the script crate at the same time. I've reviewed the code and it appears good to me, though I'll confess I don't nit "this should be a oneliner" as closely as I should. |
|
Reviewed 4 of 4 files at r1. Comments from Reviewable |
|
@larsbergstrom they were PASS -> TIMEOUT, but it could be they were intermittents before. |
|
@larsbergstrom on thinking about it, we might be able to replace timeouts on shutdown by ensuring that when a pipeline panics, it is removed from the pipeline set. We'd still have a case where a deadlocked pipeline would cause shutdown to fail though. |
highfive
commented
Jun 3, 2016
|
New code was committed to pull request. |
1 similar comment
highfive
commented
Jun 3, 2016
|
New code was committed to pull request. |
|
I'm not sure about this last commit, it adds a heartbeat for shutdown messages. Every 100ms, the compositor sends an Exit message to the constellation, which in turn sends an Exit message to the pipelines. The reason for doing this is that if a pipeline exits silently, without telling the constellation that it's doing so, we will attempt to send it an Exit message, which will fail in the same way as if the pipeline panicked. This fix turns a deadlock into a panic, which is better, but at the cost of code complexity and the possibility for spurious panic reporting, so I'm not sure it's worth it. |
|
I re-ran the wpt-tests a few times. The failures are intermittent, but
|
d2a872e
to
3422af7
highfive
commented
Jun 3, 2016
|
New code was committed to pull request. |
|
Removed heartbeat patch and squashed. |
highfive
commented
Jun 3, 2016
|
New code was committed to pull request. |
|
I think I may know what was causing the problem. Previously I was calling on shutdown: for (pipeline_id, ref pipeline) in &self.pipelines {
debug!("Exiting pipeline {:?}.", pipeline_id);
pipeline.exit();
}which closes the pipelines in random order, not respecting the tree structure. I replaced this by: // TODO: exit before the root frame is set?
if let Some(root_id) = self.root_frame_id {
self.close_frame(root_id, ExitPipelineMode::Normal);
}and everything seems much happier! |
|
Awesome! |
|
I'll take that as an r+ :) @bors-servo r=larsbergstrom |
|
|
|
(For those following along at home, there was a previous r+ on IRC http://logs.glob.uno/?c=mozilla%23servo&s=3+Jun+2016&e=3+Jun+2016#c447820 - I'm not quite that YOLO.) |
|
I added the test case from #11546. Running it in debug mode kicked up a stack trace:
which I think is cased by the paint thread calling |
highfive
commented
Jun 4, 2016
|
New code was committed to pull request. |
|
@larsbergstrom I pushed the change:
does this still look good to you? If so, I'll squash and retry. |
21d5115
to
2416072
highfive
commented
Jun 4, 2016
|
New code was committed to pull request. |
|
Squashed. |
|
IRC chat: http://logs.glob.uno/?c=mozilla%23servo&s=4+Jun+2016&e=4+Jun+2016#c447957 @bors-servo r=larsbergstrom |
|
|
…-pipeline-closure, r=larsbergstrom Avoid deadlock when closing a pipeline. <!-- Please describe your changes on the following line: --> At the moment, the constellation blocks on a pipeline during closure. This PR makes pipeline closure asynchronous. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11546. - [X] These changes do not require tests because testing for absence of deadlock is difficult. <!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11585) <!-- Reviewable:end -->
|
|
highfive
commented
Jun 4, 2016
|
|
@bors-servo retry |
…-pipeline-closure, r=larsbergstrom Avoid deadlock when closing a pipeline. <!-- Please describe your changes on the following line: --> At the moment, the constellation blocks on a pipeline during closure. This PR makes pipeline closure asynchronous. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11546. - [X] These changes do not require tests because testing for absence of deadlock is difficult. <!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11585) <!-- Reviewable:end -->
|
|
asajeffrey commentedJun 3, 2016
•
edited by larsbergstrom
At the moment, the constellation blocks on a pipeline during closure. This PR makes pipeline closure asynchronous.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is