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

Stream connection hanging forever #463

Closed
jeanp413 opened this issue Feb 15, 2023 · 8 comments · Fixed by #619
Closed

Stream connection hanging forever #463

jeanp413 opened this issue Feb 15, 2023 · 8 comments · Fixed by #619
Labels
bug Something isn't working

Comments

@jeanp413
Copy link

jeanp413 commented Feb 15, 2023

Describe the bug

I have a stream service in a server behind a proxy that has a timeout of 10 min and then closes the connection, when this happens I expect the async iterator to throw an exception (so I can reconnect again) but instead it just hangs forever.

I found this related issue in the grpc-js library which looks the same, but I've been able to workaround it by enabling sending keepalive pings with 'grpc.keepalive_time_ms' option, can a similar option be added to connect-node library?

@jeanp413 jeanp413 added the bug Something isn't working label Feb 15, 2023
@timostamm
Copy link
Member

Thanks for raising this, Jean Pierre. Stream termination with a proxy in between can be tricky.
To clarify, this happens with a client transport from @bufbuild/connect-node over H2?

Just hanging forever is not acceptable. Yes I'm sure we will be able to provide a fix for this.

@jeanp413
Copy link
Author

yes I'm using @bufbuild/connect-node over http2

@timostamm
Copy link
Member

@jeanp413, it took a while, but this should be addressed by #619. There was a straight-forward bug in the client implementation that caused connections that unexpectedly ended to hang.

We do not send HTTP/2 PING frames to keep the session alive, but it seems that your issue is likely the bug, not the keep alive.

In case you do still experience an issue after this is released, let us know.

@jeanp413
Copy link
Author

jeanp413 commented May 5, 2023

hey @timostamm just gave a quick try from sources and still can repro, but seems that the issue is not related to the proxy I mention initially, the thing is my stream service does not sent data continuously only when some event happens, so it could be that it doesn't send any data for 10 min but after that time the socket is not responsive anymore and the async iterator hangs forever, found this stackoverflow question that mentions sending keepalive pings too

@timostamm
Copy link
Member

Thanks for testing it, @jeanp413! I'm surprised to hear that it's still happening. Could you share some information about the server and your deployment?

I have created #627 specifically for HTTP/2 PING frames, and will leave this issue closed. We're currently adding client-side deadlines, so that a timeout always aborts the request without relying on the server to close. This should also help to deal with such an issue, although I'm aware it doesn't replace actively monitoring the connection.

@timostamm
Copy link
Member

I forgot to mention: Talking about HTTP/2 ping to others, I've also heard about issues with especially in combination with proxies that might terminate ack the pings for your client, while your upstream connection dies due to idle. They are not a silver bullet either.

@timostamm
Copy link
Member

@jeanp413, we have implemented keep-alive with #673. You should be able to set pingIntervalMs, which behaves very similar to grpc.keepalive_time_ms.

@jeanp413
Copy link
Author

Awesome, will try it out early next week, thanks 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants