Fix CDP proxy reconnect after Chromium restart#189
Draft
sjmiller609 wants to merge 1 commit intomainfrom
Draft
Conversation
…arts When Chromium restarts via supervisorctl, the CDP WebSocket proxy now: 1. Subscribes to upstream URL changes per proxy session, so active connections are proactively closed when the upstream URL changes (forcing clients to reconnect with the fresh URL). 2. If dialing the current upstream URL fails (stale URL from a fast restart cycle), waits up to 5s for a new URL from Subscribe and retries the dial once before giving up. Fixes CUS-109.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CUS-109: CDP proxy doesn't reconnect to Chromium after
supervisorctl restart chromium.The
WebSocketProxyHandlernow wires intoUpstreamManager.Subscribe()to handle Chromium restarts:Proactive teardown — Each proxy session subscribes to upstream URL changes. When Chromium restarts and emits a new DevTools URL, the pump context is cancelled, closing both sides and forcing clients to reconnect with the fresh upstream.
Stale URL retry — If dialing the current upstream fails (race where
supervisorctl restartcycles faster than the tail picks up the new URL), the handler waits up to 5s for a new URL via Subscribe and retries the dial once.Only
server/lib/devtoolsproxy/proxy.gois changed.wsproxy.gois untouched — the handler now callswebsocket.Accept,websocket.Dial, andwsproxy.Pumpdirectly instead of going throughwsproxy.Proxy, giving it the control needed to wire in the subscribe/cancel logic.Test plan
supervisorctl restart chromium, verify the client gets disconnected and can immediately reconnect