Skip to content
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

Assert fail #18439 #23021

Merged
merged 3 commits into from Mar 18, 2019
Merged

Assert fail #18439 #23021

merged 3 commits into from Mar 18, 2019

Conversation

@ejmg
Copy link
Contributor

ejmg commented Mar 13, 2019

This PR addresses #18439 by removing an assert statement that forces a panic whenever LoadBlocker is dropped during a GC sweep and receives a None SCRIPT_THREAD_ROOT value from mark_document_with_no_blocked_loads(). Instead of panicking on the assert, we remove it and let the None value pass silently.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #18439
  • There are tests for these changes OR
  • These changes do not require tests because ___

This change is Reviewable

@highfive
Copy link

highfive commented Mar 13, 2019

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @ferjm (or someone else) soon.

@highfive
Copy link

highfive commented Mar 13, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/script_thread.rs, components/script/document_loader.rs
  • @KiChjang: components/script/script_thread.rs, components/script/document_loader.rs
@highfive
Copy link

highfive commented Mar 13, 2019

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!
@jdm
Copy link
Member

jdm commented Mar 14, 2019

error: unused import: `std::thread`
  --> components/script/document_loader.rs:17:5
   |
17 | use std::thread;
   |     ^^^^^^^^^^^
   |
   = note: `-D unused-imports` implied by `-D warnings`
Copy link
Member

jdm left a comment

This looks like what I expected to see :)

if !thread::panicking() {
debug_assert!(self.load.is_none());
if let Some(script_thread) = self.load.take() {
self.doc.finish_load(script_thread);

This comment has been minimized.

Copy link
@jdm

jdm Mar 14, 2019

Member

We should do Some(load) instead of Some(script_thread); the value inside the Option isn't related to the script thread.

.docs_with_no_blocking_loads
.borrow_mut()
.insert(Dom::from_ref(doc));
}

This comment has been minimized.

Copy link
@jdm

jdm Mar 14, 2019

Member

Let's scope the unsafe block a little bit narrower:

SCRIPT_THREAD_ROOT.with(|root| {
    if let Some(script_thread) = root.get() {
        let script_thread = unsafe { &*script_thread };
        script_thread
            .docs_with_no_blocking_loads
            .borrow_mut()
            .insert(Dom::from_ref(doc));
    }
});

This comment has been minimized.

Copy link
@ejmg

ejmg Mar 14, 2019

Author Contributor

thank you! I didn't know I could deref the bound value in an if let like that.

@jdm jdm assigned jdm and unassigned ferjm Mar 14, 2019
@jdm
Copy link
Member

jdm commented Mar 14, 2019

I've spent a bunch of time trying to write an automated test that tickles this problem, but I have not been able to do so.

- removed unused import in document_loader.rs
- limit unsafe block in mark_document_with_no_blocked_loads in script_thread.rs
- changed name of if let value to load in Drop for LoadBlocker in document_loader.rs
@ejmg ejmg force-pushed the ejmg:assert_fail_#18439 branch from 321fdd8 to be82d7c Mar 14, 2019
@ejmg
Copy link
Contributor Author

ejmg commented Mar 14, 2019

I've made the changes requested so far and rebased them such that there are only three commits, the first two are the actual changes required for the issue (one per file change) and the last one combines all requested changes from code review.

Let me know if this works and or if there are more changes desired 🙂

@ejmg
Copy link
Contributor Author

ejmg commented Mar 18, 2019

testing a release build with my edits and I have been unable to replicate the crashes mentioned in #18439.

@jdm
Copy link
Member

jdm commented Mar 18, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Mar 18, 2019

📌 Commit be82d7c has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Mar 18, 2019

Testing commit be82d7c with merge d1b3d13...

bors-servo added a commit that referenced this pull request Mar 18, 2019
Assert fail #18439

<!-- Please describe your changes on the following line: -->

This PR addresses #18439 by removing an assert statement that forces a panic whenever `LoadBlocker` is dropped during a GC sweep and receives a `None` `SCRIPT_THREAD_ROOT` value from `mark_document_with_no_blocked_loads()`. Instead of panicking on the assert, we remove it and let the None value pass silently.

---
<!-- 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 #18439

<!-- 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/23021)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 18, 2019

💔 Test failed - mac-rel-wpt4

@jdm
Copy link
Member

jdm commented Mar 18, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Mar 18, 2019

Testing commit be82d7c with merge fde786a...

bors-servo added a commit that referenced this pull request Mar 18, 2019
Assert fail #18439

<!-- Please describe your changes on the following line: -->

This PR addresses #18439 by removing an assert statement that forces a panic whenever `LoadBlocker` is dropped during a GC sweep and receives a `None` `SCRIPT_THREAD_ROOT` value from `mark_document_with_no_blocked_loads()`. Instead of panicking on the assert, we remove it and let the None value pass silently.

---
<!-- 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 #18439

<!-- 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/23021)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 18, 2019

💔 Test failed - mac-rel-css2

@jdm
Copy link
Member

jdm commented Mar 18, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Mar 18, 2019

Testing commit be82d7c with merge 0fac8f2...

bors-servo added a commit that referenced this pull request Mar 18, 2019
Assert fail #18439

<!-- Please describe your changes on the following line: -->

This PR addresses #18439 by removing an assert statement that forces a panic whenever `LoadBlocker` is dropped during a GC sweep and receives a `None` `SCRIPT_THREAD_ROOT` value from `mark_document_with_no_blocked_loads()`. Instead of panicking on the assert, we remove it and let the None value pass silently.

---
<!-- 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 #18439

<!-- 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/23021)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 18, 2019

☀️ Test successful - android-mac, arm32, arm64, linux-rel-css, linux-rel-wpt, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, magicleap, status-taskcluster
Approved by: jdm
Pushing 0fac8f2 to master...

@bors-servo bors-servo merged commit be82d7c into servo:master Mar 18, 2019
4 checks passed
4 checks passed
Taskcluster (pull_request) TaskGroup: success
Details
Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.