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

Timeout error after Toolbox remained opened overnight #13

Closed
fioan89 opened this issue Mar 3, 2025 · 0 comments · Fixed by #53
Closed

Timeout error after Toolbox remained opened overnight #13

fioan89 opened this issue Mar 3, 2025 · 0 comments · Fixed by #53

Comments

@fioan89
Copy link
Collaborator

fioan89 commented Mar 3, 2025

Steps to reproduce:

  1. Open. Toolbox and connect to Coder.
  2. Leave it running over night

The following error is raised:

2.6.0.38311 87633 2025-02-26 21:08:03.285 INFO  -EventQueue-0 NavigatorImpl             NAVIGATION: Main ==> GatewayProvider(providerId=DevEnvironmentProviderId(id=com.coder.toolbox), initialExpanded=true)
2.6.0.38311 87633 2025-02-26 21:08:03.304 ERROR -EventQueue-0 LoggerImpl                Error fetching workspaces: java.net.SocketTimeoutException: timeout
    at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.kt:675)
    at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.kt:684)
    at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.kt:143)
    at okhttp3.internal.http2.Http2ExchangeCodec.readResponseHeaders(Http2ExchangeCodec.kt:96)
    at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
    at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at com.coder.toolbox.sdk.CoderRestClient$special$$inlined$-addInterceptor$3.intercept(OkHttpClient.kt:1089)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at com.coder.toolbox.sdk.CoderRestClient$special$$inlined$-addInterceptor$2.intercept(OkHttpClient.kt:1080)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at com.coder.toolbox.sdk.CoderRestClient$special$$inlined$-addInterceptor$1.intercept(OkHttpClient.kt:1080)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
    at retrofit2.OkHttpCall.execute(OkHttpCall.java:204)
    at com.coder.toolbox.sdk.CoderRestClient.workspaces(CoderRestClient.kt:162)
    at com.coder.toolbox.CoderRemoteProvider$poll$1.invokeSuspend(CoderRemoteProvider.kt:88)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:829)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
2.6.0.38311 87633 2025-02-26 21:08:09.617 INFO  -EventQueue-0 NavigatorImpl             NAVIGATION: GatewayProvider ==> GatewayErrorMoreInfo(devEnvironmentName=, backgroundColors=BackgroundColors(left=com.

Image

Image

@matifali matifali marked this as a duplicate of #6 Mar 18, 2025
@matifali matifali added this to the v0.1.0 milestone Mar 26, 2025
fioan89 added a commit that referenced this issue Mar 31, 2025
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
@fioan89 fioan89 closed this as completed in 4ca9190 Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants