HyukjinKwon opened a new pull request, #595: URL: https://github.com/apache/spark-connect-rust/pull/595
### What changes were proposed in this pull request? A follow-up of #577 (SPARK-61577), from a review of it. Since #577, an abortable wait stops its retries at the first interrupt of the signal watch. That holds for the release that `SparkSession::stop` waits for through `block_on_abortable`, and a running operation on the thread gives the interrupt. The release then ends with the error of `wait_aborted()`. That error went down the `Some(released) => released` arm of `stop()`, which marks the session stopped, cancels the listener bus, closes the client and returns the error. So a later `stop()` sent no ReleaseSession. `stop()` now treats that error like the arm for a signal that ends the wait itself. It returns the "the release of the session was interrupted; the session is still open" error, and neither marks the session stopped nor closes the client. ### Why are the changes needed? To match PySpark 4.3.0. Its `stop()` lets the `KeyboardInterrupt` of a signal leave the `except Exception` around the release before `client.close()` (pyspark/sql/connect/session.py:948-958). So the session stays open, and a later `stop()` releases it, as the existing arm of this client already does for a signal that ends the wait. In the Python client, no route is known that reaches the interrupt of the watch here: a progress handler runs after the stream read has marked the thread idle. So this hardens the behavior of the wait for any caller, as #548 did for `watched_abortable`. ### Does this PR introduce _any_ user-facing change? No, for the cases above. ### How was this patch tested? - `session::tests::a_stop_that_a_signal_interrupts_in_its_backoff_leaves_the_session_open`, new. The test server drops each connection, so the release fails with UNAVAILABLE and backs off for a minute, and a watch interrupts once. It asserts that `stop()` returns an error within 5 seconds, that the session is not stopped, and that its client is not closed. It fails without the change and passes with it. - `cargo test -p apache-spark-connect --release --lib` (648 passed) and `cargo test -p apache-spark-connect -p apache-spark-connect-core --release --no-run`. - The live `e2e_session_catalog` and `e2e_integration` against a Spark 4.3.0 server, the offline drop-in suites, `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]
