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 Task-queue doesn't leak tasks of closed pipelines #24096

Open
gterzian opened this issue Aug 29, 2019 · 0 comments
Open

Ensure Task-queue doesn't leak tasks of closed pipelines #24096

gterzian opened this issue Aug 29, 2019 · 0 comments

Comments

@gterzian
Copy link
Member

@gterzian gterzian commented Aug 29, 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?

Originally posted by @asajeffrey in #24072 (comment)

When looking for various potential sources of leaking the document/window, I also looked at the task-queue, since the tasks it contains could keep a Trusted<Window> and similar constructs.

While from debugging it appeared that this wasn't the source of leaks while running this script, from reading the code I did notice a potential problem, in the form of the following scenario:

  1. The task-queue uses get_fully_active_document_ids to check whether a task should be "run" or not, and that means that anything that isn't "fully active" potentially remains in the "unactive" queue.
  2. The problem with this approach is that tasks related to closed pipeline potentially leak in the "inactive" queue.
  3. For example, if a document goes from fully-active to active, and some tasks are kept as "inactive", and then the pipeline is closed. Those tasks will remain "unactive" and leak.
  4. Another example is if a performance task is throttled, and then the pipeline closed. The throttled tasks will then eventually be moved into the inactive queue, and leak.

The fix is to ensure we drain the inactive and throttled queues of tasks related to a pipeline we are closing, as part of handle_exit_pipeline_msg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.