raghav-reglobe opened a new pull request, #67032:
URL: https://github.com/apache/doris/pull/67032

   ### What problem does this PR solve?
   
   Issue Number: close #67031
   
   Problem Summary:
   
   `PipelineTask::set_running` is the scheduler's double-execute gate 
(`TaskScheduler::_do_work` re-queues a task when it returns true) and, via 
`RevokableTask`'s delegation, the mutual exclusion between a task and its 
in-flight spill revocation. It was implemented as a single 
`compare_exchange_weak` attempt. Weak CAS may fail spuriously on LL/SC 
architectures (aarch64): on a spurious failure with `_running == false` the 
caller is told "was not running" while the flag is never set, so a second 
worker acquires the same task and both execute it concurrently — one thread's 
`reset_hash_table`/`close()` then races the other's `sink_impl` on shared local 
state (production SIGSEGV @0x0 in `AggSinkOperatorX::sink_impl` on Graviton 
BEs, including two workers crashing in the same second attached to the same 
query). x86 compiles weak CAS as never-spurious, so this only reproduces on ARM.
   
   `std::atomic::exchange` keeps the exact intended semantics (return the old 
value, always store the new one) and cannot fail spuriously. Every other 
`compare_exchange_weak` in be/src sits in a retry loop; this was the only 
no-retry gate.
   
   Adds `TEST_SET_RUNNING_MUTUAL_EXCLUSION`: 8 threads hammer acquire/release 
and assert at most one concurrent holder (catches the old implementation 
probabilistically on ARM hardware; a hard invariant for the new one).
   
   ### Release note
   
   Fix a BE crash on aarch64 where two pipeline workers could execute the same 
task concurrently under spill/memory-pressure churn.
   
   ### Check List (For Author)
   
   - Test
       - [x] Unit Test
   
   - Behavior changed:
       - [x] No.
   
   - Does this need documentation?
       - [x] No.
   


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