yujun777 opened a new pull request, #62556:
URL: https://github.com/apache/doris/pull/62556
[fix](fe) Fix testExpiredJobCancellation hanging due to race condition with
daemon thread
### What problem does this PR solve?
Issue Number: close #DORIS-25120
Problem Summary: The `testExpiredJobCancellation` test in
`AnalysisTaskExecutorTest`
hangs indefinitely due to a race condition. The `AnalysisTaskExecutor`
constructor
starts a daemon thread ("Expired Analysis Task Killer") that calls
`tryToCancel()`,
which blocks on `taskQueue.take()`. The test also calls `tryToCancel()`
directly.
Two consumers race for the single item in the queue — if the daemon thread
wins,
the test thread blocks forever.
This was introduced by commit 833a8a8f98b (#62221, JMockit→Mockito
migration).
The removed JMockit agent bytecode instrumentation overhead was incidentally
slowing
daemon thread startup, making the main thread usually win the race.
The fix mocks `Env.isCheckpointThread()` to return `true` so the constructor
skips
`cancelExpiredTask()`, preventing the daemon thread from starting. This
ensures only
the test thread calls `tryToCancel()`, eliminating the race. A
`@Timeout(60)` annotation
is added as a safety net. Only the test is modified — the production
`take()` blocking
behavior is correct by design (single consumer in production).
### Release note
None
### Check List (For Author)
- Test: Unit Test (ran 5 times with 0 flakiness)
- Behavior changed: No
- Does this need documentation: 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]