Skip to content

Fix silently swallowed / unpropagated errors in bind, polling disconnect, and websocket writes - #217

Open
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1784979117-error-handling
Open

Fix silently swallowed / unpropagated errors in bind, polling disconnect, and websocket writes#217
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1784979117-error-handling

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 25, 2026

Copy link
Copy Markdown

Description

Review of error handling in the core module surfaced a few places where failures were silently swallowed or not propagated. This tightens those up without changing intended behavior.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Changes Made

  • SocketIOServer — bind failure cause was dropped. On a failed bind the code logged a generic "Failed to start server on port {}" but discarded future.cause(), so the real reason (port in use, permission denied, …) was invisible. Now logs future.cause().
  • SocketIOServer — swallowed port-resolution exception. The catch (Exception ignore) {} around resolving the actual bound port (used with port=0) is now catch (Exception e) with a debug log so the failure isn't completely invisible.
  • PollingTransport — NPE on disconnect for unknown session. The disconnect branch called client.onChannelDisconnect() without a null check, unlike onGet/onPost/onOptions. A disconnect request for an already-removed session threw an NPE up the pipeline. Now mirrors the sibling handlers: logs and returns an error response when the client is missing.
  • EncoderHandler.readVersion — swallowed IOException. An unreadable MANIFEST.MF was skipped with an empty catch; now logged at debug (still non-fatal so other manifests are still scanned).

Testing

  • All existing tests pass
  • Tests pass locally with mvn test (ran EncoderHandlerTest (21), AuthorizeHandlerTest (11), InPacketHandlerTest, PacketListenerTest)
  • mvn checkstyle:check → 0 violations
  • mvn -pl netty-socketio-core -am compile succeeds

Additional Notes

  • An earlier revision also aggregated the main WebSocket frame writes into ChannelFutureList so send-promise failures would propagate; reverted per review feedback.
  • Pub/sub event stores (NATS/Redis/Kafka) intentionally swallow-and-warn on publish/listener errors for resilience and were left unchanged.

Link to Devin session: https://app.devin.ai/sessions/99a4ba93decd4b47be31cb129923fe6e
Requested by: @sanjomo

…socket writes

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sanjomo sanjomo self-assigned this Jul 25, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@sanjomo

sanjomo commented Jul 25, 2026

Copy link
Copy Markdown
Member

@devin-ai just adding in ChannelFutureList is no use

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

@sanjomo agreed — reverted the ChannelFutureList change in handleWebsocket (8f0ea9e). The remaining fixes (bind-failure cause logging, port-resolution debug log, polling disconnect null-check, readVersion IOException log) are unchanged.

If you'd still like WebSocket write failures surfaced on the send promise, I'd rather do it properly (e.g. a PromiseCombiner over the frame writes) than bolt onto ChannelFutureList — happy to add that in a follow-up if you want it.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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.

1 participant