-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Thread leak in transportMonitor / resetAddrConn #1402
Comments
The goroutines you see are goroutines monitoring the underlying connections for each addrConn. Those are not for each RPC, so it's expected that you still see them when the RPC is done. Did you see those goroutines blocking even after the ClientConn is closed? |
IIUC you're suggesting that RPC tear down may be happening properly; we're not tearing down the backbone (i.e. the connection sockets) on which these RPCs are running? Is this something that the server should do or client should initiate. We have a bidirectional RPC. |
I'm not sure about what you want. I think the RPC finishes as expected, the goroutine you saw is not related to the RPC. To explain more on the goroutine you saw: |
Thanks for the detailed explanation. Two comments:
|
Does the same apply to the NodeJS gRPC client in terms of a pool of underlying transport clients that are handling the individual rpc calls? Is there a best practice on how to terminate a bidirectional stream between a nodejs gRPC client and a golang gRPC server? |
It's not expected to see those goroutines on the server side. These should be client side only. "Users decide to close the ClientConn" means when user calls I'm not sure about the behavior in a NodeJS client, but I would expect it to be some similar to go. We currently don't a best practice doc. But there's nothing special I can think of about terminating a bidirectional stream. The routeguide example we have should already cover everything. |
Please comment if you still believe this is a leak after making sure to close the clientconns properly. |
Please answer these questions before submitting your issue.
What version of gRPC are you using?
1.5.1
What version of Go are you using (
go version
)?go version go1.8.1 darwin/amd64
What operating system (Linux, Windows, …) and version?
Mac
What did you do?
If possible, provide a recipe for reproducing the error.
Server running a duplex connection. Simple connection establishment, and tear down by client.
Here's the skeleton of the code:
What did you expect to see?
No Thread leak
What did you see instead?
Pprof sees this:
Every RPC call shows such a thread leak
The text was updated successfully, but these errors were encountered: