Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: socket connection timeout#53

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fioan89 merged 2 commits intomainfromfix-http-socket-timeout
Apr 2, 2025
Merged

Conversation

fioan89
Copy link
Collaborator

@fioan89fioan89 commentedMar 31, 2025
edited
Loading

Context:

  • okhttp uses an HTTP/2 connection to the coder rest api in order to resolves the workspaces.
  • HTTP/2 uses a single TCP connection for multiple requests (multiplexing). If the connection is idle, the http server can close that connection, with client side ending in a socket timeout if it doesn't detect the drop in time.
  • similarly on the client side, if the OS goes into sleep mode, the connection might have been interrupted. HTTP/2 doesn't always detect this quickly, leading to stale streams when Toolbox wakes up.

Implementation:

  • we could try to force the client to use HTTP/1 which creates a TCP connection for each request, but from my testing it seems that configuring a retry strategy when a client attempts to reuse a TCP connection that has unexpectedly closed plus detecting large gaps between the last poll time and socket timeout time allows us to reset the client and create fresh TCP connections.

  • resolvesTimeout error after Toolbox remained opened overnight #13

Context:- okhttp uses an HTTP/2 connection to the coder rest api in order to resolves  the workspaces.- HTTP/2 uses a single TCP connection for multiple requests (multiplexing).  If the connection is idle, the http server can close that connection, with client side ending in a socket timeout if it doesn't detect the drop in time.- similarly on the client side, if the OS goes into sleep mode, the  connection might have been interrupted. HTTP/2 doesn't always detect this  quickly, leading to stale streams when Toolbox wakes up.Implementation:- we could try to force the client to use HTTP/1 which creates a TCP  connection for each request, but from my testing it seems that configuring  a retry strategy when a client attempts to reuse a TCP connection that  has unexpectedly closed does the job.-resolves#13
- retryOnConnectionFailure seems to not be enough there are some residual socket timeouts that can still be reproduced- with this patch we detect if the os went to sleep by measuring large gaps between the last poll time and the socket timeout exception.- if sleep is detected we reset the OkHttp client and establish a fresh TCP connection.
@fioan89fioan89 marked this pull request as ready for reviewApril 2, 2025 13:38
@fioan89fioan89 merged commit4ca9190 intomainApr 2, 2025
5 checks passed
@fioan89fioan89 deleted the fix-http-socket-timeout branchApril 2, 2025 13:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@matifalimatifalimatifali approved these changes

@bcpeinhardtbcpeinhardtAwaiting requested review from bcpeinhardt

@f0sself0sselAwaiting requested review from f0ssel

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Timeout error after Toolbox remained opened overnight
2 participants
@fioan89@matifali

[8]ページ先頭

©2009-2025 Movatter.jp