ryankert01 opened a new pull request, #3711:
URL: https://github.com/apache/iggy/pull/3711

   ## Which issue does this PR address?
   
   Closes #3710
   
   ## Rationale
   
   `GetClientsReflectsSessionRemovalAfter{Disconnect,Shutdown}` are the single 
most common CI flake: of the last 60 `Pre-merge` runs, 14 failed, and 11 of 
those were exactly these two tests, across 7 unrelated branches.
   
   ## What changed?
   
   Both tests disconnected a client and then asserted, over a second 
connection, that the session was already absent from `get_clients()`. Removal 
is server-side and happens when the server observes the closed connection 
([tcp_listener.rs#L159](https://github.com/apache/iggy/blob/master/core/server/src/tcp/tcp_listener.rs#L159)),
 which can lag the client's `disconnect`/`shutdown` call. The single immediate 
assertion therefore raced.
   
   They now poll `get_clients()` until the id disappears, with a 5s timeout, 
via a small `WaitForClientRemoved` helper. Server behaviour is unchanged; only 
the test synchronisation is fixed.
   
   ## Local Execution
   
   - The change is test-only. I could not build the C++ SDK locally (no bazel 
toolchain set up here), so I have **not** run it locally and am relying on CI 
to exercise it - flagging that explicitly rather than claiming a local run I 
did not do.
   - The diagnosis is backed by a study of the last 60 `Pre-merge` runs (11/14 
recent failures were these two tests, on unrelated branches) and by reading the 
server-side session-cleanup path.
   
   ## AI Usage
   
   1. **Which tools?** Claude (Claude Code).
   2. **Scope of usage?** Diagnosed the flake from CI history and wrote the 
test change.
   3. **How did you verify the generated code works correctly?** Reviewed the 
diff and the server cleanup path; the C++ build/tests were not run locally (no 
toolchain) and rely on CI.
   4. **Can you explain every line of the code if asked?** Yes.
   


-- 
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]

Reply via email to