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

Ensure documents drop when a pipeline exits #24072

Merged
merged 1 commit into from Aug 28, 2019

Conversation

@gterzian
Copy link
Member

gterzian commented Aug 27, 2019

minimalist companion/alternative to #24047

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #___ (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because ___

This change is Reviewable

@highfive
Copy link

highfive commented Aug 27, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/globalscope.rs, components/script/dom/document.rs, components/script/dom/window.rs
  • @KiChjang: components/script/dom/globalscope.rs, components/script/dom/document.rs, components/script/dom/window.rs
@highfive
Copy link

highfive commented Aug 27, 2019

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@gterzian gterzian force-pushed the gterzian:ensure_docs_drop branch from ab35111 to d6b0aab Aug 27, 2019
@gterzian gterzian mentioned this pull request Aug 27, 2019
0 of 5 tasks complete
@gterzian
Copy link
Member Author

gterzian commented Aug 27, 2019

@bors-servo try=wpt (expected result: CRASH [expected OK] /html/cross-origin-embedder-policy/blob.https.html)

@bors-servo
Copy link
Contributor

bors-servo commented Aug 27, 2019

Trying commit d6b0aab with merge f32ed9d...

bors-servo added a commit that referenced this pull request Aug 27, 2019
Ensure documents drop when a pipeline exits

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

minimalist companion/alternative to #24047
---
<!-- 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/24072)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 27, 2019

💔 Test failed - linux-rel-wpt

@gterzian
Copy link
Member Author

gterzian commented Aug 27, 2019

{
    "status": "CRASH", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/html/cross-origin-embedder-policy/blob.https.html", 
    "line": 197679, 
    "action": "test_result", 
    "expected": "OK"
}

Same as with #24047

@gterzian gterzian force-pushed the gterzian:ensure_docs_drop branch from d6b0aab to 344684a Aug 27, 2019
@gterzian
Copy link
Member Author

gterzian commented Aug 27, 2019

@asajeffrey @jdm Ok so this is the most minimal change required to fix the leaking of window/global/document, and to be honest I have no idea why it has to do with Performance.

This does leave in place the risk that we unknowingly start leaking those again due to a future change to another MutNullableDom, or something else.

On the plus side it's a smaller change than the other PR, and I haven't found a way to make the other PR fit better into spec concepts.

@asajeffrey
Copy link
Member

asajeffrey commented Aug 27, 2019

OK, this looks much much nicer than all the other approaches! It could be that if we didn't clear the performance list, then it ended up getting entries added to it but never removed, so if you quickly navigated away from the page it just sat there being a memory leak?

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Aug 27, 2019

📌 Commit 344684a has been approved by asajeffrey

@jdm
Copy link
Member

jdm commented Aug 27, 2019

It's cleaner, but I'm not thrilled about not actually understanding why it works.

@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2019

Testing commit 344684a with merge 09d2159...

bors-servo added a commit that referenced this pull request Aug 28, 2019
Ensure documents drop when a pipeline exits

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

minimalist companion/alternative to #24047
---
<!-- 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/24072)
<!-- Reviewable:end -->
@gterzian
Copy link
Member Author

gterzian commented Aug 28, 2019

@asajeffrey theory of performance entries being added "late" in the lifecycle of the pipeline, seems plausable, actually when debugging the other PR I did run into panics where performance.queue_entry seemed to be called after the pipeline was closed, and some of my changes(not the end results and I don't remember exactly the state of the code) would then result in a panic in such a situation.

I remember being surprised this could happen, since the message handler in the script-thread does a self.documents.find_window, which would seem to imply the queuing of a performance entry can only happen if the pipeline hasn't been closed yet.

@jdm If this could be reproduced, it could be a way to verify the "leak via performance entry that are never run" theory.

@gterzian
Copy link
Member Author

gterzian commented Aug 28, 2019

Another possiblity, since performance tasks are potentially throttled by the task-queue, is that we get the following sequence:

  1. Performance task is throttled,
  2. Pipeline is closed.
  3. Performance task is kept forever by the task-queue(it doesn't clear tasks when a pipeline is closed, in fact it sees those as tasks related to "not fully-active" documents, which is a leak in the case of a document that is not just "not fully-active" but actually related to a closed pipeline).

Although I looked into this in the other PR, and set it aside because it didn't actually seem to happen while we were still leaking windows.

@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2019

💔 Test failed - status-taskcluster

@CYBAI
Copy link
Collaborator

CYBAI commented Aug 28, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2019

💣 Failed to start rebuilding: Unknown error

@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2019

Testing commit 344684a with merge 3ade7b6...

bors-servo added a commit that referenced this pull request Aug 28, 2019
Ensure documents drop when a pipeline exits

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

minimalist companion/alternative to #24047
---
<!-- 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/24072)
<!-- Reviewable:end -->
@asajeffrey
Copy link
Member

asajeffrey commented Aug 28, 2019

The theory of the Performance takes being kept in the task queue seems plausible. Are there other instances of tasks being kept alive even though their document has been discarded?

@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: asajeffrey
Pushing 3ade7b6 to master...

@bors-servo bors-servo merged commit 344684a into servo:master Aug 28, 2019
3 checks passed
3 checks passed
Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
@gterzian gterzian deleted the gterzian:ensure_docs_drop branch Aug 29, 2019
@kanaka
Copy link
Contributor

kanaka commented Aug 29, 2019

Is this at a point where it would be worth me building and testing it?

@asajeffrey
Copy link
Member

asajeffrey commented Aug 29, 2019

It's in master, if you can take a look that would be great!

@kanaka
Copy link
Contributor

kanaka commented Aug 29, 2019

I hit a build regression on Linux I had to track down first: #24099 But it's building now and hopefully I'll have results shortly.

@kanaka
Copy link
Contributor

kanaka commented Aug 29, 2019

I posted the results over in #23905. I assume that's still the right place until the fd growth issue is fully resolved?

@gterzian gterzian mentioned this pull request Aug 29, 2019
0 of 5 tasks complete
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.

None yet

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