TomPlanche opened a new pull request, #4501:
URL: https://github.com/apache/iggy/pull/4501
## Which issue does this PR address?
Closes #4327
## Rationale
The TCP, QUIC and WebSocket clients of the Rust SDK wedge after 1000
diagnostic events. As @BrandonArp reports on #4327, a client whose server stays
down reaches this limit on its own, because each failed reconnect sweep
publishes `Disconnected`. @hubcio suggested overflow mode on the issue.
## What changed?
Each client kept the receiver of its bounded event channel so that
`subscribe_events()` can clone it, and nothing read that receiver. The channel
frees a slot only when every receiver has read it, so after 1000 events the
next publish waited forever, inside the connect that sent it. Every later call
on the client then waited behind that connect.
Now one helper, `diagnostic_event_channel()`, creates the channel in
overflow mode for the TCP, QUIC, WebSocket and HTTP clients. A full channel
drops its oldest event instead of waiting, so a subscriber that falls behind
loses old events, not the newest ones. The producer and the consumer read the
channel as a `Stream`, which skips the overflow error, so their event loops
keep running.
## Local Execution
The build and the tests ran on macOS.
- Passed: `cargo fmt --all`, `cargo sort --no-format --workspace` and `cargo
clippy --all-features --all-targets -- -D warnings`.
- Passed: `cargo test -p iggy --lib`, with 291 tests.
- Passed: the two new tests fail without overflow mode. The TCP test makes
1001 failed connects to a closed port, as in the reproduction on #4327, and
stops at the same point:
```text
connect 1001 hung
```
- Passed: the `sdk::` integration suite (77 passed), because the producer
and the consumer read these events.
- Passed: `prek run --files` on the changed files.
## AI Usage
1. Claude Code.
2. It wrote the helper, the change in the four clients and the two tests,
from the fix suggested on #4327.
3. Both new tests fail without `set_overflow(true)` and pass with it. I
checked in async-broadcast 0.7.2 that the `Stream` impl skips `Overflowed`, so
the producer and consumer loops do not stop. The suites above pass.
4. 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]