diagnostics_channel: fix ref counting bug when reaching zero subscribers#47520
Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom Apr 13, 2023
Merged
Conversation
simon-id
reviewed
Apr 12, 2023
Contributor
simon-id
left a comment
There was a problem hiding this comment.
lint issues otherwise LGTM
Member
Author
|
Yep, I'll fix those in the morning. My editor always seems to want to inject those spaces where they shouldn't be. 🙈 |
tlhunter
reviewed
Apr 12, 2023
rochdev
reviewed
Apr 12, 2023
b749f53 to
2fcddb3
Compare
Contributor
|
Fast-track has been requested by @Qard. Please 👍 to approve. |
This comment was marked as outdated.
This comment was marked as outdated.
RafaelGSS
approved these changes
Apr 12, 2023
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
Flarna
approved these changes
Apr 12, 2023
Collaborator
36 tasks
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
Collaborator
|
Landed in 6fb74c7 |
RafaelGSS
pushed a commit
that referenced
this pull request
Apr 13, 2023
PR-URL: #47520 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
RafaelGSS
pushed a commit
that referenced
this pull request
Apr 13, 2023
PR-URL: #47520 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
RafaelGSS
pushed a commit
that referenced
this pull request
Apr 13, 2023
PR-URL: #47520 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
33 tasks
targos
pushed a commit
that referenced
this pull request
Nov 10, 2023
PR-URL: #47520 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
sercher
added a commit
to sercher/graaljs
that referenced
this pull request
Apr 25, 2024
PR-URL: nodejs/node#47520 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
sercher
added a commit
to sercher/graaljs
that referenced
this pull request
Apr 25, 2024
PR-URL: nodejs/node#47520 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I discovered a bug in some of the changes I landed with TracingChannel. Technically the bug existed before, but we've been discouraging use of
channel.subscribe(...)andchannel.unsubscribe(...). With the TracingChannel changes I included a fix for the GC issue that allowschannel.subscribe(...)andchannel.unsubscribe(...)to work as they were originally intended, and some simplifications were made to make the top-level functions delegate to those. Unfortunately, there was an unnoticed issue where if the subscriber count ever dropped to zero the weakref would be deleted from the channels map but channel objects could still be held and therefore could still have subscribers added which would attempt an incRef on a weakref that's not there anymore. To handle that safely the delete actually has to happen only when there are no more strong refs, meaning when GC happens, so I've changed it to useFinalizationRegistryinstead.