How to configure timeout in hyper http server?

Hello

Hyper version : 0.14

I am following this example to implement a reverse proxy.

When backend(another application, not rust) was handling the request emitted by my proxy and took too long time. Hyper interrupts the http connection

Line 38, client.request(req) does not return from my test but the connection from web browser to proxy is interrupted.

It seems there is some timeout in hyper http server , and the timeout value changes from 60s to 300s in different environment.

I searched in doc, cannot find any method for that.

Any thought?

thanks


UPDATE: TCP dump shows the connection is terminated by my proxy. tcp keep alive is enable but that does not help. still investigating.

Sorry, I misread the post.

In Rust, libraries don't need to support timeouts themselves. Rust futures can be easily aborted, which means that every Future can be timed out externally. See tokio's timeout.

I think the goal is to disable the timeout behaviour. :sweat_smile:

Are you sure it is not your backend server that timed out?

What are these different environments? Is your hyper proxy or your backend server hosted behind some other proxy/load balancer? NGINX perhaps?

I'm asking, because I can't find any settings for connection timeouts in hyper either (neither for client or server). But a 60s timeout sounds suspiciously like the default timeout settings of the NGINX ingress controller, which cost me days trying to figure out why my server was timing out, even though I turned off any timeouts.

It may also be a TCP timeout if keepalive isn't enabled

1 Like

Reason found. the connection is terminated because Kubernetes Ingress drops the inbound connection and hence hyper terminates the service execution and hence the connecton to backend is also terminated. strange that it does not raise any error when inbound connection is terminated.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.