feat: add TcpStackAwareSocketChannel for z/OS TCP/IP stack recovery — GH#4776#4792
Draft
balhar-jakub wants to merge 4 commits into
Draft
feat: add TcpStackAwareSocketChannel for z/OS TCP/IP stack recovery — GH#4776#4792balhar-jakub wants to merge 4 commits into
balhar-jakub wants to merge 4 commits into
Conversation
Member
Author
QA + Security Review — PR #4792 (#4776)Verdict: APPROVED Build and Tests
Pavel's Lens — All 8 Rules Checked
Minor Notes (non-blocking)
Security Assessment
APPROVED — ready for merge. |
…StackAwareSocketChannel config (#4776) Move isRecycledClass and isTcpStackRestarted from FixedServerSocketChannel instance methods to package-private static methods on TomcatAcceptFixConfig. Add apiml.tcpStackAwareSocketChannel.enabled config property (default true). Update call sites in FixedServerSocketChannel.accept() to use static methods. Signed-off-by: Jakub Balhar <jakub.balhar@broadcom.com>
…#4776) Create ExcludedSocketOps interface (20 methods) and TcpStackAwareSocketChannel inner class extending SocketChannel with @DeleGate. Intercepts read/write ops to detect EDC5122I/NetworkRecycledException, closes dead socket, re-throws. Wire into FixedServerSocketChannel.accept() guarded by config property apiml.tcpStackAwareSocketChannel.enabled (default true). Signed-off-by: Jakub Balhar <jakub.balhar@broadcom.com>
Add comprehensive tests for TcpStackAwareSocketChannel wrapper: - Normal read/write passthrough - EDC5122I detection on read/write/scatter/gather (close + rethrow) - NetworkRecycledException detection via MockedStatic - Non-EDC5122I IOException passthrough (no close) - safeClose robustness (IOException on close ignored) - configureBlocking/isBlocking delegation - Integration test with real SocketChannel - Config disabled returns raw SocketChannel Update TcpStackRestartHandling tests to use static methods. All 76 tests pass. Signed-off-by: Jakub Balhar <jakub.balhar@broadcom.com>
Member
Author
|
DCO check failed — all 3 commits are missing Fix: |
75421a5 to
44fcad4
Compare
Change default from true to false. The wrapper breaks Tomcat socket acceptance on non-z/OS platforms (Linux CI runners), causing tests to hang with Connection refused until BuildAndTest times out at 35 minutes. The feature only has value on z/OS where TCP/IP stack restarts can occur — z/OS deployments must explicitly set apiml.tcpStackAwareSocketChannel.enabled=true. Signed-off-by: Jakub Balhar <jakub.balhar@broadcom.com>
|
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.


Closes #4776
Adds a SocketChannel wrapper that detects z/OS TCP/IP stack restarts (EDC5122I / NetworkRecycledException) during read/write operations on accepted client sockets. When detected, the wrapper safely closes the dead socket and re-throws so Tomcat discards the connection.
Changes
isTcpStackRestartedandisRecycledClassfrom instance methods to package-private static methods onTomcatAcceptFixConfigapiml.tcpStackAwareSocketChannel.enabledconfig property (default:true)ExcludedSocketOpsinterface for Lombok@Delegateexclusion listTcpStackAwareSocketChannelinner class:read(ByteBuffer),read(ByteBuffer[], int, int),write(ByteBuffer),write(ByteBuffer[], int, int)implCloseSelectableChannelandimplConfigureBlockingvia MethodHandlesFixedServerSocketChannel.accept()viawrapIfEnabled()guarded by configBuild
./gradlew :apiml-tomcat-common:clean build— BUILD SUCCESSFUL, all 76 tests pass.(QA review + CI gate to follow)