fix: Improve how we deal with WS closures#34
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughdefaultProxyWebSocket now runs two concurrent copy goroutines and uses directional results plus an atomic flag to attribute close frames. proxyWebSocketCopy was changed to report whether a close frame was sent. Backend graceful closes (1000, 1001, and echoed no-status) return nil and do not mark the endpoint unhealthy; unexpected backend close codes or backend copy errors mark the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/server/server.go`:
- Around line 1317-1330: Change proxyWebSocketCopy to return (error, bool) where
the bool indicates whether the error came from Read (readErr) vs Write, then
update the two goroutines that call proxyWebSocketCopy(backendConn, clientConn)
and proxyWebSocketCopy(clientConn, backendConn) to send wsResult using the
returned readErr rather than the goroutine-sourced fromBackend flag; use the
readErr to attribute the failure to the reader peer and call
markEndpointUnhealthyProtocol against backend or client accordingly. Ensure
wsResult (and any consumers) accept the new readErr flag, propagate it through
errc, and adjust the code that waits on errc and performs
clientConn.Close()/backendConn.Close() to use the new attribution logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2c8700af-8aa3-4ca5-a366-3b3acae59c73
📒 Files selected for processing (2)
internal/server/server.gointernal/server/ws_close_test.go
…h read vs write failures
This makes sure the connection is always properly closed by aetherlay whenever the remote endpoint closes it for any reason. In some cases, we track the closure as an issue, but we always close the connection.
This should fix an issue where the end user has a socket open but no data flows through it. I have to run more tests.
Summary by CodeRabbit
Bug Fixes
Tests