Skip to content

Avoid spurious session errors after listener-initiated disconnect - #784

Merged
ar merged 1 commit into
mainfrom
fix/isoserver-listener-disconnect
Sep 16, 2026
Merged

ar merged 1 commit into
mainfrom
fix/isoserver-listener-disconnect

Conversation

@ar-agt

@ar-agt ar-agt commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #783.

After dispatching a received message to the request listeners, stop the session receive loop if the channel is no longer connected. A listener can deliberately disconnect a client without the next receive generating a misleading session-error / unconnected ISOChannel.

The existing listener return-value contract, final disconnect, server disconnect event, and SessionEnd path are unchanged. Genuine receive, listener, and cleanup failures remain visible; peer EOF and socket-error handling are unchanged. This does not suppress arbitrary I/O exceptions or eliminate races with unrelated asynchronous disconnects.

Regression coverage (eight tests)

  • Listener disconnects and returns true: no additional receive or spurious error.
  • Listener disconnects and returns false: remaining listeners still run before session exit.
  • Connected sessions continue receiving messages; EOF retains normal cleanup behavior.
  • Real CSChannel loopback exchange followed by a listener-initiated disconnect.
  • Receive failure, listener failure after disconnect, peer socket error, and cleanup failure retain their logging behavior.
  • Exactly one server disconnect event and SessionEnd in each tested path.

Three deterministic regression cases failed against unchanged main, then passed with the fix.

Validation

  • Pinned Java 26.0.2-amzn / Gradle 9.7.1.
  • Server/channel focused suites passed.
  • Full ./gradlew check assemble javadoc passed: 4,472 tests reported, zero failures/errors, 69 skipped. All eight new regression tests passed.
  • Whitespace check passed.

An intermediate full run hit the existing TSpaceTest.testNotifyReaders 500 ms timing assertion. The complete TSpaceTest class passed in isolation and the subsequent full check passed without changing or excluding any tests. Validation was on macOS, including a loopback socket exchange; no separate Linux run was performed.

@ar
ar merged commit 9806f91 into main Sep 16, 2026
1 check passed
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.

ISOServer logs a listener-initiated disconnect as session-error ("unconnected ISOChannel")

2 participants