HyukjinKwon opened a new pull request, #541:
URL: https://github.com/apache/spark-connect-rust/pull/541
### What changes were proposed in this pull request?
A follow-up of #508 / #536 (SPARK-61440), from a review of it:
- `with_deadline` (`crates/spark-connect-core/src/client.rs`) sends a
per-RPC deadline longer than gRPC's `grpc-timeout` can encode as the longest
timeout it encodes, 99,999,999 hours. tonic's `Request::set_timeout` panics
with "duration is unrealistically large" on a longer one, and `with_deadline`
runs before `stream_deadline_in` on every call, so the `Duration::MAX` deadline
that #508 made "no longer panic" still panicked there. No call reaches the
clamped timeout, so such a call runs as without a deadline, and the client-side
bound (`tokio::time::timeout`, which takes `Duration::MAX`) and
`stream_deadline_in` are unchanged.
- `Retrying`, `Backoff`, `RetryError` and `retrying` in `retries.rs` are
`pub(crate)`: nothing outside the crate uses them, and #508 did not mean to add
them to the public API of `apache-spark-connect-core`. `RetryPolicy` and
`RetryPolicyState` stay public.
- **A Ctrl-C ends an artifact upload that the server does not answer.** The
backoffs of the upload's retries already ended with a signal, but the
AddArtifacts RPC of an attempt was not under `until_abort`, so `addArtifacts` /
`copyFromLocalToFs` against a server that accepts the connection and never
answers held until its deadline (about 80 s), where PySpark's blocking gRPC
call raises `KeyboardInterrupt` at once. The attempt now waits for its RPC
under `until_abort(ABORT_RETRIES)`, as the attempts of `with_retry` do; the
Python bindings take the signal watch since SPARK-61470 (#535). The mock server
can hold an AddArtifacts call unanswered.
- `test_backoff_waits_the_delay_of_the_attempt_before_a_retry` no longer
asserts that a backoff with no retry left returns within 40 ms, which a loaded
CI runner can miss; the `Backoff::GiveUp` result already shows that no retry is
made.
### Why are the changes needed?
`RpcDeadlines { reattachable_execute_plan: Some(Duration::MAX),
reattach_execute: Some(Duration::MAX), .. }` made `execute_plan_reattachable`
panic at tonic's `request.rs`, although #508 says that such deadlines no longer
panic.
### Does this PR introduce _any_ user-facing change?
Yes, on unreleased changes: a deadline longer than about 11,400 years no
longer panics, and the call runs to its result; a Ctrl-C during an unanswered
artifact upload raises `KeyboardInterrupt` at once in the Python client. The
four retry helpers leave the public API of the core crate, which has not been
released with them.
### How was this patch tested?
- `deadlines_too_long_for_the_grpc_timeout_are_sent_and_the_calls_run` in
`crates/spark-connect-core/tests/deadlines.rs`: a reattachable execution and
its reattach with `Duration::MAX` deadlines against the loopback server. It
panics without the fix and passes with it.
- `test_with_deadline_too_long_for_the_grpc_timeout_is_the_longest_one_sent`
in `client.rs`: no header without a deadline, `600000m` for 600 s, `99999999H`
for `Duration::MAX`. It panics without the fix.
-
`test_sigint_while_an_artifact_upload_is_unanswered_raises_keyboard_interrupt`
in `python/tests/test_dropin_offline.py`: the mock server holds the
AddArtifacts call, and a SIGINT raises `KeyboardInterrupt` within about 1 s.
Without the change it waits for the mock's 15 s gate.
- `cargo test -p apache-spark-connect-core --release` (lib 215 passed;
`deadlines`, `reattach_cleanup`, `artifact_uploads`), `cargo test -p
apache-spark-connect --release --lib` (613 passed), the offline drop-in suites
(1991 passed), the artifact tests of `test_dropin_e2e.py`, `cargo test -p
apache-spark-connect -p apache-spark-connect-core --release --no-run`, `cargo
build -p pyspark-rs --release`, `cargo fmt --all -- --check`,
`scripts/audit_no_stubs.sh`, and `e2e_reattach_drop` against a Spark 4.3.0
server.
### 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]