Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [dolphinscheduler-master] fix WorkflowExecuteRunnable's executeTask method return incorrect value #15741

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

ZhongJinHacker
Copy link
Contributor

Purpose of the pull request

This pull request to fix #15740 , fix the method return incorrect value problem.

please check the issue out for details

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(or)

If your pull request contain incompatible change, you should also add it to docs/docs/en/guide/upgrede/incompatible.md

@ruanwenjun
Copy link
Member

Right now, pause task will also use this method to submit, and should return false, this change will influence the whole process. Is there a case to reproduce this bug?

@ZhongJinHacker
Copy link
Contributor Author

ZhongJinHacker commented Mar 20, 2024

to executeTask method's logic, I can understand the logic intention. Only executeTask success will return true, and if write the taskInstance to db fail or throw Exception will return false.
But in the follow code:
image

it is incorrect. the log ("Submit standby task: {} failed")also can express this. when taskInstance write to db unsuccessfully.processService.submitTask will return false, it let into the code block. and return true . this incorrect boolean value will cause the out layer caller who call executeTask method think the task is executed successfully, but in the fact, the task do not write into database's table

@ZhongJinHacker
Copy link
Contributor Author

ZhongJinHacker commented Mar 20, 2024

image

if taskInstanceDao.submitTaskInstanceToDB do not success, the taskinstance will do not submit to db.
and return false.here is correct. But its caller executeTask will return true in its code, it will cause this problem

you can use my unit test to reproduce this bug, or close the db or simulate the db Fault when call submitTask in debug mode

@@ -908,7 +908,7 @@ private boolean executeTask(TaskInstance taskInstance) {
// todo: remove this method
if (!processService.submitTask(workflowInstance, taskInstance)) {
log.error("Submit standby task: {} failed", taskInstance.getName());
return true;
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that it should return false if it submits to DB failed, not sure if there are other considerations.
but there is also a todo here. cc @ruanwenjun
will we remove this method or fix this logic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better not to change this logic unless we find a bug related to this issue. When the workflow instance is READY_STOP, it will also submit the task, but will return false here to avoid dispatch the task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] [dolphinscheduler-master] WorkflowExecuteRunnable's executeTask method return incorrect value
3 participants