[Bug] [MasterServer] Submit duplicate tasks
Search before asking
- [X] I had searched in the issues and found no similar issues.
What happened
1.Many SQL tasks submitted at the same time 2.It will be retried when a task fails, and may be submitted multiple times when retrying 3.The task instance code is the same for multiple submissions
[INFO] 2022-01-04 00:50:34.791 org.apache.dolphinscheduler.service.process.ProcessService:[1076] - end submit task to db successfully:6838135 013.XXX:SUBMITTED_SUCCESS complete, instance id:609369 state: RUNNING_EXECUTION [INFO] 2022-01-04 00:50:35.315 org.apache.dolphinscheduler.service.process.ProcessService:[1076] - end submit task to db successfully:6838145 013.XXX:SUBMITTED_SUCCESS complete, instance id:609369 state: RUNNING_EXECUTION



What you expected to happen
When the task is retried, submit it once.
How to reproduce
The reason is unknown.
Anything else
No response
Version
2.0.1
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Hi:
- Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
- In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
- If you haven't received a reply for a long time, you can subscribe to the developer's email,Mail subscription steps reference https://dolphinscheduler.apache.org/en-us/community/development/subscribe.html ,Then write the issue URL in the email content and send question to [email protected].
@mchcz can you provide the DAG info? I can't reproduce it at local.

When task A fail and run WorkflowExecuteThread.taskFinished, it will add retry task into standby queue, which will submit by WorkflowExecuteThread.submitPostNode and StateWheelExecuteThread.checkTask4Retry; When I add sleep 30s in submitTaskInstanceToDB like Figure 4, it will increase the probability of repeated retries. In this way, retry task A in standby list will be submit by WorkflowExecuteThread.submitPostNode because run task c, and then, StateWheelExecuteThread.checkTask4Retry add it into standby list and submit again.