[Fix-18570][Master] Detect wrapped CommandDuplicateHandleException in bootstrapError (#18570) - #18573
Merged
SbloodyS merged 2 commits intoAug 21, 2026
Conversation
…trapError (apache#18570) The exception is raised inside a CompletableFuture chain and reaches bootstrapError wrapped in CompletionException, so the direct instanceof check never matched and the healthy first execution was force-failed. Use ExceptionUtils.throwableOfType so the wrapper is seen through.
hellodml
requested review from
SbloodyS,
caishunfeng and
ruanwenjun
as code owners
August 20, 2026 09:41
|
Thanks for opening this pull request! Please check out our contributing guidelines. (https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md) |
|
Awesome work, congrats on your first merged pull request! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was this PR generated or assisted by AI?
YES. The investigation, the one-line change and the unit test were produced with the help of Claude (Anthropic), working from production logs of my own 3.4.2 deployment. Everything was compiled and tested locally before submitting, and the fix direction was proposed by @ruanwenjun in #18570.
Purpose of the pull request
Closes #18570.
CommandDuplicateHandleExceptionis raised inside aCompletableFuturechain and therefore reachesCommandEngine.bootstrapErrorwrapped inCompletionException. The directinstanceofcheck cannot see through the wrapper, so the duplicate branch is never taken and the workflow instance is force-failed instead.Why this matters beyond a wrong log line:
forceUpdateWorkflowInstanceState(..., FAILURE)only updates the DB row. It does not remove the execution fromworkflowRepositorynor deregister its event bus. The still-running first execution then has a FAILURE row underneath it:so it can never complete and never leaves the in-memory repository. Since
MasterServerLoadProtectionreadsthe count can no longer fall and
CommandEnginekeeps refusing to consume commands. In our production incident the logged count sat at exactly 25 against a limit of 20 for two hours (25 x 7194log lines in a single hour, no other value), 553 of the 573 workflow instances created in that window never got a single task instance row, and only a restart recovered it.Brief change log
CommandEngine.bootstrapError: useExceptionUtils.throwableOfType(...)instead ofinstanceofso the exception is still recognised when wrapped.ExceptionUtilswas already imported in this file, so no new import is required.CommandEngineTestcovering the wrapped, doubly-nested and unwrapped cases.Verify this pull request
Covered by the new unit test. Reverting only the production line makes exactly the two wrapped cases fail while the unwrapped case still passes:
Verified against the
devbranch with Maven 3.9.6 / JDK 8u492 (mvn -pl dolphinscheduler-master -am install -DskipTests, thenmvn -pl dolphinscheduler-master test -Dtest=CommandEngineTest).The failure is a Mockito verification failure on
workflowInstanceDao.forceUpdateWorkflowInstanceState, i.e. it points directly at the workflow being wrongly force-failed.Notes for reviewers
bootstrapErroris private, so the test invokes it throughReflectionTestUtils. If that is not acceptable here, droppingprivateand marking it visible-for-testing works equally well and needs no test change.transactionTemplateis mocked to run its callback inline. Without that the non-duplicate branch throws NPE instead of producing a clear verification failure; the test still distinguishes fixed from unfixed either way.IllegalStateException: WorkflowExecuteRunnable(...) already registered(reproducible by re-running individual tasks of a finished workflow instance in quick succession), nor whether executions already wedged inworkflowRepositoryget cleaned up.