csurong opened a new issue, #18735: URL: https://github.com/apache/dolphinscheduler/issues/18735
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A task can finish and its workflow can reach a final state, while the executor is still waiting for its terminal event to be acknowledged. This happens when the Master persists the result but the ACK does not reach the executor. The workflow can then finish and be removed from the in-memory repository. When the executor reports the same event again, TaskExecutorEventListenerImpl only looks in that repository and throws `Cannot find the WorkflowExecuteRunnable`. Even after communication recovers, the retry cannot get an ACK. The task itself has stopped running, but the pending report and executor registration remain. The normal FINALIZE cleanup never starts; for physical executors, the execution slot also remains occupied. I reproduced this locally against dev at 751ed03522 by injecting an ACK failure and letting the workflow finish before retrying the report. ### What you expected to happen Once communication recovers, the Master should be able to acknowledge an already-persisted terminal result even if the workflow has left the cache. The executor should then complete its normal finalization and release its registration and execution slot. ### How to reproduce The timing can be reproduced deterministically with an injected ACK failure: 1. Run a workflow with two serial tasks, A -> B, and let both succeed. 2. In the executor client delegator, make attempts to send B's SUCCESS ACK throw before the ACK reaches its reporter. Keep delivery blocked until the workflow has finished. 3. Wait for the workflow to be SUCCESS in the database and absent from IWorkflowRepository. B's terminal event should still be pending, and its executor should still be registered. 4. Restore ACK delivery and let the reporter resend B's pending event. 5. The original listener throws on the missing workflow instead of acknowledging the persisted result. The event remains pending and no FINALIZE event is emitted. There is a related case with a failed task waiting for retry: lose its FAILED ACK, then pause or stop the workflow before the retry runs. The same task record becomes PAUSE or KILL, while the executor is still reporting FAILED. A recovery check needs to account for these valid state changes too. ### Anything else The proposed fix is to check the persisted task and workflow when a terminal report arrives after cache eviction. It should verify the task/workflow IDs, executor host, compatible terminal state and finalized workflow before resending the original ACK. This does not require replaying workflow events or updating task state. The accompanying PR will include regression tests for lost SUCCESS ACKs and lost FAILED ACKs followed by pause/stop. These use the existing Spring/H2 integration setup with logic executors and assert resource release after the report is retried. I checked the existing ACK reports, including #15345. That older issue concerns an ACK timeout interrupting workflow completion; this report concerns executor cleanup after the workflow has already finished. ### Version dev ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
