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

We should forward the subscribers abort signal to eventListeners #187

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

maraisr
Copy link
Collaborator

@maraisr maraisr commented Dec 11, 2024

I think there is a possible event listener leak that can occur if we don't have a mechanism to clean up event listeners as subscriptions are aborted.

In WebKit I confirmed, that if we were to follow the spec we'd keep listeners around for a little too long:

CleanShot 2024-12-11 at 09 32 01

Much like Chrome's EventTarget implementation, WebKits' also immediately take ownership of the EventListener, so that despite the Observable is marked for GC (active == 0), the listener hangs around.

and I think Chrome had a similar discovery, as they also forward the signal to the event listener to trigger the abort steps.


Preview | Diff

@maraisr
Copy link
Collaborator Author

maraisr commented Dec 11, 2024

cc @domfarolino

Copy link
Collaborator

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a great catch.

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@maraisr
Copy link
Collaborator Author

maraisr commented Dec 12, 2024

Thank you so much for your review here @domfarolino, I have addressed the points. You're so good at this spec stuff. Learning a bunch.

Copy link
Collaborator

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the contribution!

@domfarolino
Copy link
Collaborator

Despite me updating a8bfae2, this is still failing for a pesky build reason. Would you be able to rebase this PR off of the new master branch (on top of a8bfae2 basically) and we can try the build again? I think it might be building with an old version of ubuntu.

@maraisr
Copy link
Collaborator Author

maraisr commented Dec 12, 2024

@domfarolino I have rebased from the current master. Let's hope that fixes the CI.

@domfarolino domfarolino merged commit 5df4a38 into WICG:master Dec 12, 2024
2 checks passed
github-actions bot added a commit that referenced this pull request Dec 12, 2024
SHA: 5df4a38
Reason: push, by domfarolino

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants