gavinchou opened a new pull request, #68145:
URL: https://github.com/apache/doris/pull/68145
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
`UtilTest.delay` relied on one-second sleeps to make two normal callbacks
overlap with a later cancellation task. Thread-pool dequeue order does not
guarantee callback entry order, so the cancellation task could set the stop
token before an earlier normal task checked it, making that task invalid and
causing the result vector to be empty.
Replace timing-based sleeps with two countdown events. The cancel task waits
until both normal callbacks have entered, and the normal callbacks wait until
the cancellation predicate has observed the cancel value. A fixed three-thread
pool guarantees all three callbacks can enter without relying on scheduler
timing.
### Release note
None
### Check List (For Author)
- Test
- [ ] Regression test
- [x] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason
Validation:
- `local_to_dev run --no-sync cloud-ut --run
--filter=util_test:UtilTest.delay`
- ASAN `util_test --gtest_filter=UtilTest.delay --gtest_repeat=1000
--gtest_break_on_failure`
- Behavior changed:
- [x] No.
- [ ] Yes.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### 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]