Skip to content

fix(ENGEN-3331): prevent handler deadlock on credentials channel in listener mode#372

Merged
upvest-mike merged 3 commits intoupvestco:mainfrom
jboewer:engen-3331-fix-timeout-bug
Mar 11, 2026
Merged

fix(ENGEN-3331): prevent handler deadlock on credentials channel in listener mode#372
upvest-mike merged 3 commits intoupvestco:mainfrom
jboewer:engen-3331-fix-timeout-bug

Conversation

@jboewer
Copy link
Contributor

@jboewer jboewer commented Mar 11, 2026

What

Replace blocking channel send with non-blocking select in handler.go when forwarding credentials to the webhook tunnel system.

Why

When running with -l, the proxy sends user credentials to Tunnels.Start() via an unbuffered channel after each /auth/token request. If TunnelIsReady() fails during tunnel startup, Start() returns early and nobody reads from the channel. The next /auth/token request blocks forever on the channel send, deadlocking the handler goroutine - even though the HTTP response has already been written.

The non-blocking select drops the credentials when no reader is available, which is correct since the response is already sent and the tunnel system is not running.

@upvest-mike upvest-mike merged commit d9b71fe into upvestco:main Mar 11, 2026
1 check passed
@jboewer jboewer deleted the engen-3331-fix-timeout-bug branch March 11, 2026 13:35
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 this pull request may close these issues.

2 participants