-
Notifications
You must be signed in to change notification settings - Fork 321
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
Timeout redesign for 6.x #773
Comments
Quoting my thoughts from #754 (comment) here. |
A couple of questions we probably want to answer with a design:
|
The useful stages of the request lifecycle to me are:
I don't see a benefit to mutually exclusive timeouts as timeouts can just be a min-heap (or array sorted in descending order) of deadlines before the client gives up. As for guarantees, this depends on how often we check the current time against the next deadline. If we spend most of our time in socket operations (likely), then checking only on socket operations may be a tight enough bound. I don't think requests should override the connect timeout as requests don't map one-to-one to connect operations. The rest of the timeouts make sense for a request to want to override. The reason I think this is fine is because a total timeout covers the case where the connection takes too long. If the client is slow to connect, having a tighter bound on just the connect operation is an optimization to fail fast since the client is willing to wait until the total timeout if it was the request or response portion that was slow. |
One thing to keep in mind during the design (something that we overlooked in the current implementation) is that read timeout should correctly handle timeouts during both stages:
|
@ClearlyClaire @misalcedo we're looking at shipping v6.0.0 in #790. It's the last chance to make breaking changes to the timeout subsystem. Would either of you like to open a PR, or find someone else who would? |
I just made a pull request remotely related to this: #793 (Happy Eyeballs) My opinion (my requests (if I may))If someone is introducing breaking changes about timeout, I would recommend lumping timeouts as parts of network implementation abstractions. Real-world exampleIn my pull request, I swap ::Timeout.timeout(@time_left, ConnectTimeoutError) do implemented there. The new class also supports DNS resolution timeouts. I hopeLumping timeout-related options into the TCP implementation abstractions will leave more options for the future when we want to introduce new improvements without breaking changes. Easily manage different possible configurations for different network backends. |
Exactly my thought. My ExpressionIn response to
I could help try extracting the connect timeout into the TCP backend layer. Probably just an upgraded version of #793. I don't write a lot of code if you green light this:
|
This is a tracking issue for redesigning the timeout subsystem in
http
6.x.It would be good to come up with a new design first, and then PRs implementing it.
The largest single issue seems to be having a cumulative timeout over the entire request which actually works (originally requested in #562).
Several people have expressed interest in working on this, and I believe some code has already been written, although isn't available in a public PR.
cc @ClearlyClaire @misalcedo
The text was updated successfully, but these errors were encountered: