HyukjinKwon opened a new pull request, #523:
URL: https://github.com/apache/spark-connect-rust/pull/523
### What changes were proposed in this pull request?
A follow-up of #509 (SPARK-61441), from a review of the listener bus that it
restructured (`crates/spark-connect/src/streaming.rs`):
- **A listener added from the terminal error of its subscription stays
subscribed.** When a worker begins its terminal failure, the bus marks its
generation as terminating, together with the record that the server may still
hold its listener. `add_listener` then opens a new subscription instead of
joining the generation that is ending. Before, a listener re-added from
`on_stream_error` joined the ending generation, which then cleared it, while
`add_listener` had returned `Ok`.
- **A panic of a session progress handler during the removal of the last
listener no longer leaves the bus stopping.** `stop_listener_bus` catches the
unwind of the reported removal, finishes the removal as a failed one (the phase
goes back to idle and the registrations and the worker are kept for a retry, as
for a removal that fails), and resumes the panic. Before, the phase stayed
`Stopping` and the next `close()` waited forever.
- **The drop of the bus isolates the drops of the listeners it still
holds**, as #509 isolates them on the four paths that remove listeners: a panic
of a listener's `Drop` when a session is dropped without `close()` is reported,
not propagated.
- The locking notes said that dropping the event stream of a subscription
runs the progress handlers of the user. Its execution is unreported, so no user
code runs there; the notes say so now.
### Why are the changes needed?
#509 documents adding listeners again as the way to subscribe again after a
terminal error, and says that a bus whose listeners or handlers panicked keeps
working. Both failed: the re-added listener was dropped silently, and a
panicking progress handler made the next `close()` hang.
### Does this PR introduce _any_ user-facing change?
Yes, in the Rust API, on unreleased behavior: a listener re-added from
`on_stream_error` receives the events of the new subscription; `close()`
returns after a progress handler panicked during a listener removal; dropping a
session no longer propagates the panic of a listener's `Drop`.
### How was this patch tested?
- `a_listener_added_from_the_stream_error_of_its_generation_is_subscribed`
and `dropping_the_bus_isolates_the_panic_of_a_listener_it_still_holds` (unit
tests in `streaming.rs`): the first fails without the change, and the test
binary aborts on the second ("panic in a destructor during cleanup").
- `streaming_listener_readded_from_a_stream_error_receives_events` and
`streaming_listener_close_returns_after_a_panicking_progress_handler` in
`crates/spark-connect/tests/e2e_streaming.rs`, against a Spark 4.3.0 server:
the first fails and the second times out after 60 s without the change.
- `cargo test -p apache-spark-connect --release --lib` (610 passed),
`e2e_streaming` (7 passed, also with a 1 MiB `senderMaxStreamSize`), the
`--no-run` builds, the offline drop-in suites (1945 passed), `cargo fmt --all
-- --check` and `scripts/audit_no_stubs.sh`.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5
This pull request and its description were written by Isaac.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]