anton-vinogradov opened a new pull request, #13327: URL: https://github.com/apache/ignite/pull/13327
https://issues.apache.org/jira/browse/IGNITE-28855 Regression of IGNITE-26111. Before it, `ClientImpl.SocketStream` owned a single `BufferedInputStream` shared by every reader of the discovery socket. After the refactoring, `Reconnector` and `SocketReader` each create their own `TcpDiscoveryIoSession`, each wrapping the raw socket into a new `BufferedInputStream`. When the router writes the reconnect response and a subsequent discovery message back-to-back (single TCP segment — typical during a topology storm), the Reconnector's session reads ahead and buffers the bytes of the following message; the socket is then handed over to `SocketReader`, which attaches a fresh session to the raw socket — the buffered bytes are silently discarded and the message is lost forever. Depending on whether more topology messages follow, the client either fails with `AssertionError: lastVer=N, newVer=N+2` in `updateTopologyHistory` or silently stays on a stale topology. Fix: create `TcpDiscoveryIoSession` once per socket (in `sendJoinRequest`, the same session that has read the handshake response) and carry it inside `SocketStream`; `Reconnector` and `SocketReader` reuse it. This restores the pre-IGNITE-26111 invariant: a single buffered reader per socket. Reproducer `TcpDiscoveryClientTopologyGapTest` mirrors the failing `IgniteCachePartitionLossPolicySelfTest` scenario (5 servers + 4 clients, sequential graceful stop of 3 servers including the clients' router and the coordinator): without the fix a client gets stuck one topology version short within ~150 iterations, with the fix 3x300 iterations pass clean. `TcpClientDiscoverySpiSelfTest` (52 tests), `TcpDiscoveryPendingMessageDeliveryTest` and `TcpClientDiscoverySpiCoordinatorChangeTest` pass as well. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
