Skip to content

Conversation

etraut-openai
Copy link
Collaborator

This PR fixes a bug that results in a hang in the oauth login flow if a user logs in, then logs out, then logs in again without first closing the browser window.

Root cause of problem: We use a local web server for the oauth flow, and it's implemented using the tiny_http rust crate. During the first login, a socket is created between the browser and the server. The tiny_http library creates worker threads that persist for as long as this socket remains open. Currently, there's no way to close the connection on the server side — the library provides no API to do this. The library also filters all "Connect: close" headers, which makes it difficult to tell the client browser to close the connection. On the second login attempt, the browser uses the existing connection rather than creating a new one. Since that connection is associated with a server instance that no longer exists, it is effectively ignored.

I considered switching from tiny_http to a different web server library, but that would have been a big change with significant regression risk. This PR includes a more surgical fix that works around the limitation of tiny_http and sends a "Connect: close" header on the last "success" page of the oauth flow.

@etraut-openai etraut-openai merged commit 609f75a into main Oct 1, 2025
20 checks passed
@etraut-openai etraut-openai deleted the etraut/oauth_hang branch October 1, 2025 19:26
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants