HyukjinKwon commented on PR #508:
URL:
https://github.com/apache/spark-connect-rust/pull/508#issuecomment-6809693828
The three CI failures on cf0aa70 (Rust build and test, Rust behavioral e2e,
coverage) are the same stack overflow, and I could reproduce each locally:
`deep_request_stack_tests` (release, 512 KiB thread),
`request_fields_tests::requests_carry_the_client_type_extensions_and_observed_session_of_pyspark`
(debug) and `array_literals_run_on_the_server` (debug).
The cause is the attempt of `with_retry`. It is an async block that captures
the future of the RPC (`let call = op(); async move {
until_abort(ABORT_RETRIES, call).await ... }`), and such a block keeps that
future twice: once as its capture and once as what it awaits. That makes every
call future of the client about half again as large. Measured with
`size_of_val` in a release build on macOS arm64:
| future | master f4974a6 | cf0aa70 | with the change below |
|---|---:|---:|---:|
| `analyze_plan` | 74,968 | 109,848 | 75,528 |
| `execute_plan_reattachable` | 35,808 | 52,136 | 36,264 |
| `config` | 10,072 | 15,208 | 10,632 |
A combinator keeps the future once:
```rust
use futures::FutureExt;
self.with_attempts(|| {
crate::runtime::until_abort(crate::runtime::ABORT_RETRIES,
op()).map(|attempt| {
match attempt {
Some(result) => result.map_err(RetryError::Status),
None => Err(RetryError::Aborted(wait_aborted())),
}
})
})
.await
```
With it, all three tests pass locally. The commit, on top of cf0aa70 and
fast-forwardable, is
HyukjinKwon/spark-connect-rust@9fb87fbb16b597a66e6793ee2bcc5fa41a2fd028 (branch
`SPARK-61440-with-retry-future-size`). Could you pull it into this branch, e.g.
`git pull https://github.com/HyukjinKwon/spark-connect-rust.git
SPARK-61440-with-retry-future-size`?
Separately, #522 (SPARK-61469) moves the future of `block_on` onto the heap,
which gives the small-stack tests more headroom. It doesn't replace this
change, because the debug test threads overflow in the poll frames too.
--
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]