zhengruifeng opened a new pull request, #58566:
URL: https://github.com/apache/spark/pull/58566

   ### What changes were proposed in this pull request?
   
   Add a dedicated `RpcDeadlines.release_ml_cache` deadline, defaulting to 60 
seconds, for the
   best-effort Spark Connect ML cache deletion and cleanup RPCs.
   
   Route `_delete_ml_cache` and `_cleanup_ml_cache` through a bounded, 
non-reattachable `ExecutePlan`
   call. The deadline can be disabled with `RpcDeadlines.disabled()`.
   
   This follows the cleanup deadline model introduced by SPARK-58846 in #58085.
   
   ### Why are the changes needed?
   
   SPARK-57655 added a same-thread re-entrancy guard for ML cache cleanup after 
a rare gRPC deadlock,
   but the outer cleanup RPC can still block indefinitely if its response is 
never delivered.
   `_delete_ml_cache` can run from a `RemoteModelRef` finalizer, and 
`_cleanup_ml_cache` runs during
   client shutdown, so an unbounded call can hang a test or process 
indefinitely.
   
   The normal reattachable `ExecutePlan` deadline does not bound the total 
cleanup time because it
   reattaches and starts a new deadline interval. ML cache eviction is best 
effort, and cached state
   is also released when the server session ends, so these cleanup calls can 
safely use a bounded,
   non-reattachable deadline.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Spark Connect ML cache deletion and cleanup now time out after 60 
seconds by default instead
   of potentially blocking indefinitely. Users can configure the timeout with
   `RpcDeadlines(release_ml_cache=<seconds>)` or disable it with 
`RpcDeadlines.disabled()`.
   
   ### How was this patch tested?
   
   Added a regression test that verifies both ML cache deletion and full 
cleanup forward the
   configured deadline, and that `RpcDeadlines.disabled()` forwards no 
deadline. Updated the existing
   default, disabled, and positional-argument deadline tests.
   
   Ran:
   
   ```bash
   python/run-tests -p 1 --testnames 
pyspark.sql.tests.connect.client.test_client,pyspark.sql.tests.connect.client.test_client_retries
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-5)
   


-- 
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]

Reply via email to