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: Fix a couple of things that came up while investigating a memory leak #2456

Merged

Conversation

murgatroid99
Copy link
Member

The first fix, in client.ts is to null the callerStackError variable before the onReceiveStatus callback returns. The Error object retains information about the stack trace where it was created, including context objects. In the specific case where a new request is initiated while handling the result of a previous request, the new request's callerStackError would retain a stack context that includes the previous callerStackError. If done in a ping-pong type loop, this retention could be recursive.

The second fix is to ensure that non-OK statuses caused by picker errors (especially if the channel is not connected) are emitted asynchronously. If emitted synchronously, if calls are retried unconditionally and synchronously, the process could make no progress towards reconnecting, resulting in an infinite loop.

@murgatroid99 murgatroid99 merged commit 25e2845 into grpc:@grpc/grpc-js@1.8.x Jun 5, 2023
4 of 5 checks passed
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

2 participants