-
Notifications
You must be signed in to change notification settings - Fork 651
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
Using gRPC over named pipes causes issues when grpc.client_idle_timeout_ms
elapses
#2642
Comments
grpc.client_idle_timeout_ms
elapses
Those logs show a connection that is already IDLE, but it doesn't give any indication of why it became IDLE, or what else is going on that should affect the state. It would help to see the full log, from the start of the process to after you observe this problem. |
Here are the logs. I have not included every log since the start of the application, since it has to run for 30 minutes before I get the issue, but I did put a few seconds before the issue arises. There's nothing interesting before and after the portion I shared. I annotated exactly where the requests start to fail. It seems clear that the connection goes Idle because something times out, even though we see that the connection receives requests a few seconds before that. We also see that the connection switches between There is a little bit of my application scrambled with it, but grpc logs are easy to differentiate. |
That's definitely a bug. It looks like idle timer references are getting discarded but not cancelled, so they just fire later whether or not they should. I'm guessing you're calling |
I do call I could have perfectly achieved that if there was a getter for the connection state instead, but that didn't exist so I used that function. Does that make sense ? |
If I understand correctly, the behavior you want is if a connection drops, any calls made between then and when a connection is re-established will wait for the connection to be ready and then make the request, instead of failing immediately. You can accomplish that by providing metadata with the In addition, there is actually a getter in the public API for the connection state, but it's a little obscure: |
I did use |
In general, you want to set a deadline on the call itself, but that is especially important when using the |
Yeah that makes sense. My case is a bit complicated, because I send files to be scanned to an external process, and scan time can vary depending on the file. I didn't want to deadline to whole request, but I wanted to deadline the connection part, which wasn't possible. I don't expect this to be supported as it's fairly unique to my use-case, that's why I check connectivity manually. Thanks for the piece of code you shared above, that's really helpful! |
I see. I understand why a request deadline wouldn't be good for your use case. However, if you are willing to adjust your protocol a little, I see another way to create an effective connection timeout without calling the |
I'll look into that. Thanks for the tip, and thanks for the quick reply and fix 😺 |
I see the PR has been merged and released. Thanks a lot for this, I'm gonna close the issue 😃 Have a good one! |
#2649 |
Problem description
When using gRPC over Named pipes on Windows (IPC), while also firing requests continuously using multiple async requests for over 30 minutes, the connection eventually drops and never recovers. Another important detail is that I use only streaming requests with the server.
This is the actual logs that I get
I have traced the issue back to the property
grpc.client_idle_timeout_ms
, and I believe this issue might be linked to this function.I have tried using
tcp
instead ofnamed pipes
and it works without any problem.Reproduction steps
It is very difficult to give exact reproduction steps, as I have no idea what might be causing this. I have a huge amount of code around it, I think that someone with knowledge of the code might better understand why my connection is detected as
idle
even though I'm using it like crazy for streaming requests. Is it possible that streaming requests don't count as requests and that the connection timeout is not reset ?Environment
@grpc/[email protected]
The text was updated successfully, but these errors were encountered: