Mrhs121 commented on code in PR #18694:
URL:
https://github.com/apache/dolphinscheduler/pull/18694#discussion_r4245408451
##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/executor/LogicTaskExecutor.java:
##########
@@ -66,6 +75,7 @@ public void pause() {
// if the status is initialized, then we can directly change to paused
if (logicTask != null) {
logicTask.pause();
+ resetStateTrackTime();
Review Comment:
Thanks for pointing this out. I reviewed the logic and didn't find a path
where the reset itself would cause an infinite loop. However, I did identify a
concurrency issue between state checks and pause/kill operations.
An immediate state check is still needed after pause/kill: these operations
update the dependent task's plugin state, but the executor reports that state
during its next check. Once the configured `checkInterval` is respected, a
value of `900s` could otherwise delay pause/kill status reporting by almost 15
minutes.
I've replaced `resetStateTrackTime()` with a one-time request using
`AtomicBoolean`. Only the tracking thread now updates `latestStateTrackTime`.
It consumes the request with `getAndSet(false)` before polling, so a request
arriving during a check remains pending for the next iteration. Without another
request, polling resumes at the configured interval; paused/killed tasks are
removed from active tracking. A single request does not keep triggering checks.
I also found an existing race in `DependentLogicTask`: a dependency query
could return after pause/kill and overwrite the paused/killed state. State
reads and writes now use short synchronized blocks, and query results are
applied only if the task is still running. The database query stays outside the
lock, so pause/kill does not have to wait for it. I kept this protection in the
same PR to cover pause/kill both while waiting for the next check and while a
dependency query is running.
All 15 regression tests pass, including deterministic concurrency tests
using a 20-second check interval.
--
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]