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 upMake network listener runnable cancellable #12277
Conversation
highfive
commented
Jul 5, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jul 5, 2016
|
Here's a test that might work:
|
|
@jdm turns out, the panic only occurs if the iframe is same-origin, which seems bad since they could share the same script thread. |
632324b
to
2246f58
|
I added a test case that fails w/o the cancellable changes. |
2246f58
to
0cd7688
|
I want to run a few tries on this to make sure it fixes #11703. |
…r=<try> Make network listener runnable cancellable <!-- Please describe your changes on the following line: --> This keeps scripts from executing after its script thread has been shut down. --- <!-- 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 #12048 and fix #11703 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/12277) <!-- Reviewable:end -->
|
If the test in question shuts down the shared script thread, that's a problem that we should be fixing :) |
|
@jdm after the iframe is removed, the page still runs fine with the test results. So I assume that means the script thread for the parent isn't shut down. |
|
True! |
| @@ -0,0 +1 @@ | |||
| // this script does nothing | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jul 6, 2016
Member
This script should call a function in the parent page which would make the test fail. Something like
window.script_executed = t.unreached_func("script executed in removed iframe") in the parent, and in the child: script_executed = parent.script_executed; then invoke script_executed() in this JS file.
0cd7688
to
411acaf
|
@bors-servo try |
…r=<try> Make network listener runnable cancellable <!-- Please describe your changes on the following line: --> This keeps scripts from executing after its script thread has been shut down. --- <!-- 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 #12048 and fix #11703 and fix #12284 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/12277) <!-- Reviewable:end -->
|
Well this does not seem to fix the intermittent :( |
|
|
|
The backtrace of the most recent panic is coming from a DOMManipulationTask runnable, not a network one. |
|
@jdm is it possible to do something similar with that runnable? |
|
What I'm wondering is why we're still running events for a script thread that's been shut down... |
|
Oh, it's not the script thread that is shut down, it's a window that's had its JS context information cleared because it is not supposed to be needed any more. Bah. |
|
There are a bunch of things in DOMManipulationTask that use Runnable which could theoretically be hooked the same way. The FireEvent and FireSimpleEvent messages would need special handling to ignore those messages if they're targeted at elements of a window that are closed, I guess ;( |
|
Fwiw, it's never been clear to me what the JSContext clearing is for. |
|
The goal was to avoid hanging on to JS memory longer than necessary, since clearing it can end up removing the last user of the JS runtime. |
|
I think I will leave this one as it is, and open a new PR when trying to solve the issue with |
|
I don't think so; the script thread should keep hanging on to the runtime/context. |
|
So the wrapper uses Relaxed atomic ordering. Which means that even if the bool is written to from the script thread, it's not necessary that the other thread will see this write in time. We should either use SeqCst ordering, or Release on the script thread side writes and acquire from the wrapper reads. Reviewed 5 of 6 files at r1, 1 of 5 files at r3, 1 of 1 files at r4, 3 of 3 files at r5. tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/script-not-executed-after-shutdown-child.html, line 9 [r5] (raw file):
Perhaps a longer delay would ensure intermittents won't happen on a system experiencing heavy load (like our testing infrastructure at times)? (Bump the 3000 up as well, of course) Comments from Reviewable |
411acaf
to
5526756
|
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed. tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/script-not-executed-after-shutdown-child.html, line 9 [r5] (raw file):
|
|
@bors-servo r+ Reviewed 6 of 6 files at r6, 4 of 4 files at r7, 2 of 2 files at r8. Comments from Reviewable |
|
|
…r=Manishearth Make network listener runnable cancellable <!-- Please describe your changes on the following line: --> This keeps scripts from executing after its script thread has been shut down. --- <!-- 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 (maybe) #12048 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/12277) <!-- Reviewable:end -->
|
|
|
@bors-servo retry
|
…r=Manishearth Make network listener runnable cancellable <!-- Please describe your changes on the following line: --> This keeps scripts from executing after its script thread has been shut down. --- <!-- 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 (maybe) #12048 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/12277) <!-- Reviewable:end -->
|
|
cbrewster commentedJul 5, 2016
•
edited by jdm
This keeps scripts from executing after its script thread has been shut down.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is