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

grpc-js: Hold a reference to transport in SubchannelCall #2336

Conversation

murgatroid99
Copy link
Member

#2318 (comment) reported a regression in that previously fixed issue. I suspect that the problem is that once a subchannel stops using a transport, nothing has a reference to that transport, which makes it eligible to be garbage collected. To avoid this, the subchannel call now holds a reference to the transport, so it stays alive as long as at least one active call is using it.

I also removed the disconnectListener because it became unused in the previous refactor.

Copy link

@gnossen gnossen left a comment

Choose a reason for hiding this comment

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

Is there a way to reproduce this issue in a unit test?

@murgatroid99
Copy link
Member Author

The problem with bugs like this is that the test framework code seems to change the behavior. I do have a set of local interop tests that run the client in a separate process in order to catch some bugs like this, but they don't catch this one and I don't know why. In this specific case, if I'm right and it's tied to garbage collection, that makes it even more unpredictable.

@murgatroid99 murgatroid99 merged commit f29e99d into grpc:@grpc/grpc-js@1.8.x Jan 25, 2023
@yamen
Copy link

yamen commented Jan 25, 2023

Any open "ref" in my scripts would cause the bug not to appear (presumably because GC isn't triggered at the same time). But it appears 100% consistently in scripts that are very simple and guarantee no other open refs.

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.

None yet

3 participants