Skip to content

Commit 13beb04

Browse files
authored
fix: disable keepalives in workspaceapps transport (#11789)
Connection caching causes requests to hit the wrong workspaces. See comment. Fixes #11767
1 parent 1e2634d commit 13beb04

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

coderd/externalauth/externalauth.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func (c *DeviceAuth) AuthorizeDevice(ctx context.Context) (*codersdk.ExternalAut
347347
case mediaType == "application/x-www-form-urlencoded":
348348
return nil, xerrors.Errorf("status_code=%d, payload response is form-url encoded, expected a json payload", resp.StatusCode)
349349
default:
350-
return nil, fmt.Errorf("status_code=%d, mediaType=%s: %w", resp.StatusCode, mediaType, err)
350+
return nil, xerrors.Errorf("status_code=%d, mediaType=%s: %w", resp.StatusCode, mediaType, err)
351351
}
352352
}
353353
if r.ErrorDescription != "" {

coderd/tailnet.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ func NewServerTailnet(
103103
transport: tailnetTransport.Clone(),
104104
}
105105
tn.transport.DialContext = tn.dialContext
106-
tn.transport.MaxIdleConnsPerHost = 10
106+
107+
// Bugfix: for some reason all calls to tn.dialContext come from
108+
// "localhost", causing connections to be cached and requests to go to the
109+
// wrong workspaces. This disables keepalives for now until the root cause
110+
// can be found.
111+
tn.transport.MaxIdleConnsPerHost = -1
112+
tn.transport.DisableKeepAlives = true
113+
107114
tn.transport.MaxIdleConns = 0
108115
// We intentionally don't verify the certificate chain here.
109116
// The connection to the workspace is already established and most

0 commit comments

Comments
 (0)