@@ -32,7 +32,6 @@ use std::collections::VecDeque;
3232use std:: pin:: Pin ;
3333use std:: sync:: { Arc , LazyLock } ;
3434use std:: task:: { Context , Poll } ;
35- use std:: time:: Duration ;
3635
3736use arrow:: array:: {
3837 Array , ArrayRef , BinaryViewArray , BufferSpec , GenericByteViewArray , StringViewArray ,
@@ -520,11 +519,10 @@ struct AsyncIPCStreamWriter {
520519 abort_handle : Option < tokio:: runtime:: Handle > ,
521520}
522521
523- /// Bounds detached cleanup work after query cancellation. If all permits are
524- /// occupied, the writer is dropped and the backend lifecycle policy is the
525- /// remaining cleanup mechanism.
522+ /// Bounds the number of detached cleanup tasks after query cancellation. If all
523+ /// permits are occupied, the writer is dropped and the backend lifecycle policy
524+ /// is the remaining cleanup mechanism.
526525const MAX_CONCURRENT_SPILL_ABORTS : usize = 8 ;
527- const SPILL_ABORT_TIMEOUT : Duration = Duration :: from_secs ( 30 ) ;
528526static SPILL_ABORT_PERMITS : LazyLock < Arc < tokio:: sync:: Semaphore > > =
529527 LazyLock :: new ( || Arc :: new ( tokio:: sync:: Semaphore :: new ( MAX_CONCURRENT_SPILL_ABORTS ) ) ) ;
530528
@@ -649,16 +647,12 @@ impl Drop for AsyncIPCStreamWriter {
649647 } ;
650648
651649 let _abort_task = handle. spawn ( async move {
652- match tokio:: time:: timeout ( SPILL_ABORT_TIMEOUT , writer. abort ( ) ) . await {
653- Ok ( Ok ( ( ) ) ) => { }
654- Ok ( Err ( error) ) => {
655- debug ! ( "Failed to abort dropped spill writer: {error}" ) ;
656- }
657- Err ( _) => {
658- debug ! ( "Timed out aborting dropped spill writer" ) ;
659- }
650+ // Backends bound their own abort latency; the runtime may not have
651+ // a time driver. See the AsyncSpillWriter::abort contract.
652+ if let Err ( error) = writer. abort ( ) . await {
653+ debug ! ( "Failed to abort dropped spill writer: {error}" ) ;
660654 }
661- // `permit` is released when this bounded cleanup task exits .
655+ // Keep the permit until cleanup finishes .
662656 drop ( permit) ;
663657 } ) ;
664658 }
@@ -936,6 +930,7 @@ mod tests {
936930 use std:: io:: Cursor ;
937931 use std:: sync:: Mutex ;
938932 use std:: sync:: atomic:: { AtomicBool , AtomicUsize , Ordering } ;
933+ use std:: time:: Duration ;
939934 use tokio:: sync:: Notify ;
940935
941936 struct YieldingAsyncWriter {
0 commit comments