[Bug][API] Switching workflow versions leaves schedules online
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start with WorkflowDefinitionServiceImpl.switchWorkflowDefinitionVersion and compare it with WorkflowDefinitionServiceImpl.offlineWorkflowDefinition. Inspect ProcessServiceImpl.switchVersion to confirm why the schedule remains online, then reuse schedulerService.offlineSchedulerByWorkflowCode after a successful version switch. Verify through the workflow version-switch API that the workflow, schedule, and Quartz job become offline or are removed immediately.
Written by the indexing model from the issue text.
Description
Search before asking
- I searched the existing issues and did not find an issue describing this behavior.
What happened
Switching an online workflow to another definition version marks the workflow definition as OFFLINE, but leaves its schedule ONLINE and its Quartz job registered.
This differs from the normal workflow offline action, which immediately offlines the associated schedule and removes its Quartz job. With version switching, schedule cleanup is delayed until the next scheduled trigger detects that the workflow is offline.
What you expected to happen
Switching workflow definition versions should offline the associated schedule and remove its Quartz job immediately, just like the normal workflow offline action. It should not wait for the next scheduled trigger.
How to reproduce
- Create a workflow with at least two definition versions.
- Publish the workflow and enable its schedule, with the next trigger sufficiently far in the future.
- Open the workflow version list and switch to a different version, or call the workflow version-switch API.
- Observe that the workflow is
OFFLINE, while its schedule remainsONLINEand its Quartz job still exists. - At the next scheduled trigger, the schedule task detects the offline workflow and cleans up the schedule.
Root cause
WorkflowDefinitionServiceImpl.switchWorkflowDefinitionVersion delegates to ProcessServiceImpl.switchVersion. The latter writes the target workflow version with ReleaseState.OFFLINE, but does not offline its schedule.
By contrast, WorkflowDefinitionServiceImpl.offlineWorkflowDefinition calls schedulerService.offlineSchedulerByWorkflowCode, which updates the schedule state and removes its Quartz job.
Suggested fix
After switching the workflow version successfully, call the existing offlineSchedulerByWorkflowCode method from the API service. Reuse the existing behavior for workflows without schedules and for schedules that are already offline.
Version
Current dev branch, inspected at commit 751ed0352.
Are you willing to submit a PR?
- Yes, I am willing to submit a PR.
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 5.1k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 22
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/dolphinscheduler
-
[Bug] Switching workflow versions can scan all task definition logsPossibly taken @zhuangchong claimed this today. Open
Difficulty 3/5 Half a day Newbie friendliness 68/100
apache/dolphinscheduler#18733 ·
Maintainers usually reply within 1 day
-
[Feature][Datasource] Support Kyuubi three-segment JDBC URL syntax (<sessionVars>?<hiveVars>#<kyuubiVars>) in Kyuubi datasource pluginPossibly taken @silvermissile claimed this 1 day ago. Openbackend feature
apache/dolphinscheduler#18725 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Improvement][Worker-SqlTask] Make the default query row limit (QUERY_LIMIT = 10000) configurablePossibly taken @njnu-seafish claimed this 10 days ago. Openbackend improvement UI
apache/dolphinscheduler#18702 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Improvement][APIServer][3.4.3] Task Instance page data loading time out.Possibly taken @karthikeya-tummala claimed this 10 days ago. Openbackend good first issue improvement
apache/dolphinscheduler#18700 · 6 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
[Improvement][API] Suspected inverted session expiry check invalidates active sessions on re-loginPossibly taken @karthikeya-tummala claimed this 10 days ago. Openbackend good first issue improvement
Difficulty 4/5 1-2 days Newbie friendliness 48/100
apache/dolphinscheduler#18699 · 5 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in apache/dolphinscheduler
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
checkstyle/checkstyle#22153 ·
Maintainers usually reply within 1 day
-
Documentation Needs Triage
Difficulty 1/5 Under an hour Newbie friendliness 78/100
frankframework/frankframework#11908 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ome/ome-codecs#48 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
tonihele/OpenKeeper#672 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
eclipse-ee4j/angus-mail#224 ·