sollhui opened a new pull request, #68264:
URL: https://github.com/apache/doris/pull/68264

   ### What problem does this PR solve?
   
   Adaptive flush callbacks can outlive the ThreadPool objects they borrow. 
Workload group ID changes make teardown cancel a different registration name, 
and timer cancellation can miss a rearmed timer or free its state before an 
already-started callback acquires its mutex. These races can crash the backend 
during workload group changes or shutdown.
   
   - Save a stable, per-pool registration key and cancel it even when adaptive 
adjustment has subsequently been disabled.
   - Read the final timer ID under the callback mutex, then wait for brpc to 
finish any running callback before releasing its state.
   - Serialize registration, cancellation and stop; drain duplicate 
registrations and reject registration after stop.
   - Stop adaptive callbacks before backend pool teardown, and cancel 
registrations on direct WG scheduler destruction.
   
   ### Release note
   
   Fix backend crashes caused by adaptive flush callbacks accessing released 
thread pools during workload group changes or backend shutdown.
   
   ### Check List (For Author)
   
   - Test
       - [x] Unit Test: added coverage for callback-entry and rearm races, 
concurrent cancellation, duplicate registration, registration after stop, and 
WG ID changes/reuse with config-disabled teardown. Tests were not run on this 
master branch at the requester's direction.
       - Formatting, build hygiene and whitespace checks passed. The 
cherry-picked patch matches the original patch ID.
   - Behavior changed:
       - [x] Yes. Cancellation drains callbacks before returning; stop prevents 
further registration.
   - Does this need documentation?
       - [x] No.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


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