-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backend: prevent panic in WebSocket multiplexer #2731
Conversation
This fixes a race condition in the WebSocket multiplexer where sending a COMPLETE message could panic if the connection was closed. Added proper connection state checking and error handling to safely handle closed connections. - Add connection state check before writing messages - Return early if connection is already closed - Add error logging for failed writes - Properly handle WriteJSON errors Signed-off-by: Kautilya Tripathi <[email protected]>
Backend Code coverage changed from 63.4% to 63.6%. Change: .2% 😃. Coverage report
|
@knrt10 got the same issues again with this patch applied. // ./github.com/farodin91/headlamp/backend/cmd/multiplexer.go:60 I hope the multiplexer patch another bug. i have but no. |
@farodin91 Can you please provide more info? It would be great if you please help me reproducing this issue. Can you please help with your setup and what led to this error. Anything will help. Thanks |
@knrt10 Could we call later? |
Pinged you on k8s slack |
Backend Code coverage changed from 63.4% to 63.6%. Change: .2% 😃. Coverage report
|
Previously, WebSocket messages were being filtered out after receiving a COMPLETE message, which prevented the UI from updating when resources changed. This fix removes the filtering logic to ensure all updates are processed, keeping the UI in sync with the cluster state. Signed-off-by: Kautilya Tripathi <[email protected]>
372deba
to
dd7080c
Compare
Backend Code coverage changed from 63.4% to 63.7%. Change: .3% 😃. Coverage report
|
dd7080c
to
75ddf6e
Compare
COMPLETE messages are not critical for functionality since the client will continue to receive updates even if the COMPLETE message fails. Changed the log level to reduce noise in error logs while maintaining visibility through info logs. Signed-off-by: Kautilya Tripathi <[email protected]>
75ddf6e
to
9c0d977
Compare
Backend Code coverage changed from 63.4% to 63.7%. Change: .3% 😃. Coverage report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks
This fixes a race condition in the WebSocket multiplexer where sending a COMPLETE message could panic if the connection was closed. Added proper connection state checking and error handling to safely handle closed connections.
Ref: #2563 (comment)