[BUG] some tasks would be running all the time when db delayed.
Because of inserting MySQL and ZK data in a transaction, ZK data would be inserted first, when mysql data is delayed for some reason, worker cannot find the corresponding MySQL data when getting ZK data, which causes the problem that the worker deletes ZK data, and the task would be running all the time.
Describe the bug task state would not change when db delayed.
Which version of Dolphin Scheduler: -[1.2.0]
hi, @lenboo In reading the source code, I happened to see here and also saw the mailing list. I found that the main problems appeared in the following three places:
-
ProcessDao # submitTaskInstanceToMysql, saveTaskInstance The method returned true or false to indicate whether the insert was successful, but it is directly ignored here, this may lead to inserting a task to zk that does not exist in db,
-
ProcessDao # submitTask, submitTaskToQueue also returned true or false to indicate whether the insert was successful, also be ignored here, it's the same question,
-
and, in the taskQueue.add() method, the exception was discarded directly, just printed an error log, but submitTaskToQueue() is to determine whether the addition is successful by catching the exception, This will cause the method to always return to add successfully even if the task fails to add,
This is all the problems I found, maybe you can check again if there are other problems, if not, can you allow me to fix thees bug? I am very willing to do this job, and maybe you can review it after I finish, I just need a little time to fix it, thanks,
Code format display is always problematic, so I put the code snippet here
public TaskInstance submitTaskInstanceToMysql(TaskInstance taskInstance, ProcessInstance processInstance){
....
saveTaskInstance(taskInstance);
return taskInstance;
}
public TaskInstance submitTask(TaskInstance taskInstance, ProcessInstance processInstance){
.......
submitTaskToQueue(task); // >>>> 提交到zk队列
return task;
}
thank you very much for suggestions. i will consider about them seriously. you can make some supplements after my pr.
Thank you very much.
1.2.1 solved this problem, you can upgrade to >= 1.2.1 at the same time, if your version is lower than 1.2.1, you also can manually resolve this issue:
- clear the task queue in zk for path: /dolphinscheduler/task_queue
- change the state of the task to failed( integer value: 6).
- run the work flow by recover from failed
1.2.1解决了这个问题,你可以同时升级到>= 1.2.1 ,如果你的版本低于1.2.1,你也可以手动解决这个问题:
- 清除zk中的任务队列路径:/dolphinscheduler/task_queue
- 将任务状态更改为失败(整数值:6)。
- 通过从失败中恢复来运行工作流程
我的2.0.5版本也有这个问题,工作流实例一直不停止,实际已经报错了。
1.2.1解决了这个问题,你可以同时升级到>= 1.2.1 ,如果你的版本低于1.2.1,你也可以手动解决这个问题:
- 清除zk中的任务队列路径:/dolphinscheduler/task_queue
- 将任务状态更改为失败(整数值:6)。
- 通过从失败中恢复来运行工作流程
我的2.0.5版本也有这个问题,工作流实例一直不停止,实际已经报错了。
我的也是
1.2.1解决了这个问题,你可以同时升级到>= 1.2.1 ,如果你的版本低于1.2.1,你也可以手动解决这个问题:
- 清除zk中的任务队列路径:/dolphinscheduler/task_queue
- 将任务状态更改为失败(整数值:6)。
- 通过从失败中恢复来运行工作流程
我的2.0.5版本也有这个问题,工作流实例一直不停止,实际已经报错了。
我的3.0.1也有这个问题,通过上面的方法处理后还是有这个问题