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

Workflow Prematurely Ends After Timer Start Event in SpiffWorkflow v3.0.0rc2 #390

Closed
vcodx opened this issue Feb 19, 2024 · 2 comments
Closed

Comments

@vcodx
Copy link

vcodx commented Feb 19, 2024

Description:

I've encountered an issue in SpiffWorkflow version v3.0.0rc2 where workflows are unexpectedly ending following a Timer Start Event. This behavior diverges from the expected, where the workflow should proceed to the next tasks defined in the BPMN diagram.

Steps to Reproduce:

  1. Utilize the SpiffWorkflow version v3.0.0rc2.
  2. Use the code in gist links to reproduce.

Observed Behavior:

The workflow ends immediately after the Timer Start Event, without progressing to subsequent tasks.

Expected Behavior:

The workflow should continue beyond the Timer Start Event, executing subsequent tasks as defined in the BPMN diagram.

Task Tree Dump for Timer Start Event:

ff3f742d-5d7f-4974-9002-d672fe7a0d6a/0: Task of Start (BPMN Task) State: READY Children: 1
  794cdb15-ecc5-45c8-9385-257c81d6e8ed/0: Task of StartEvent_1 (Timer Start Event) State: FUTURE Children: 0

Link to reproduce https://gist.github.com/vcodx/f688a65a70f312a0b2e16a642842426d

Task Tree Dump for Default Start Event:

bf66f690-8183-4c43-a34b-667168746790/0: Task of Start (BPMN Task) State: READY Children: 1
  cdd047c7-6632-415b-88c3-1438f88d4613/0: Task of StartEvent_1 (Default Start Event) State: FUTURE Children: 1
    aac07adb-df96-415c-b507-2da07233eb8b/0: Task of Activity_1n1t0x1 (Manual Task) State: FUTURE Children: 1
      f9a7b630-8b92-4a3f-8a3b-ccd90abb743e/0: Task of Event_1e0ho54 (Default End Event) State: FUTURE Children: 1
        be676d0f-0ede-4e40-aee4-c7251a3eb910/0: Task of Process_YzA9iBf.EndJoin (BPMN Task) State: FUTURE Children: 1
          2b539bb1-bf6b-4d0a-8b1e-d27daa8eaad6/0: Task of End (BPMN Task) State: FUTURE Children: 0

Link to reproduce https://gist.github.com/vcodx/aec4aa51c9561322c5de93d0ef566507

@essweine
Copy link
Contributor

Cycle timer children are not created until the timer actually fires, so that's why the tasks don't appear immediately as they would with normal start events. This a change from previous versions of spiff (it was reported as a bug in #370).

After you complete the placeholder start task, the BPMN start task enters a waiting state, and only after the first cycle passes will the remainder of the tasks be created. Once you start running the workflow, the tasks should appear and be runnable.

After running the first task workflow.get_next_task(state=TaskState.READY).run() you should see

92238ae1-92db-4c36-994d-c55b30838c97/0: Task of Start (BPMN Task) State: COMPLETED Children: 1
  5bca361b-15c6-4dab-b635-13b1cdc2a3cf/0: Task of StartEvent_1 (Timer Start Event) State: WAITING Children: 0

After 10 seconds, refresh the waiting tasks (workflow.refresh_waiting_tasks())

92238ae1-92db-4c36-994d-c55b30838c97/0: Task of Start (BPMN Task) State: COMPLETED Children: 1
  5bca361b-15c6-4dab-b635-13b1cdc2a3cf/0: Task of StartEvent_1 (Timer Start Event) State: WAITING Children: 1
    7b883521-0a0a-4568-872e-c84962b501ec/0: Task of Activity_1n1t0x1 (Manual Task) State: READY Children: 1
      a8ca6bdd-c4a1-473c-8f6e-469f9c9422fe/0: Task of Event_1e0ho54 (Default End Event) State: FUTURE Children: 1
        9363b60d-baad-454e-871f-7cbe2f51b597/0: Task of Process_YzA9iBf.EndJoin (BPMN Task) State: FUTURE Children: 1
          8c550ef8-d0eb-4056-a518-ea04ce6cc19a/0: Task of End (BPMN Task) State: FUTURE Children: 0

Arguably, it might be better to create one branch of tasks in a FUTURE state and mark them as READY when the timer completes, but I'm not sure how easy that would actually be (and what potential issues it could cause).

@vcodx
Copy link
Author

vcodx commented Feb 20, 2024

Works for me, thank you for the clarification @essweine

@vcodx vcodx closed this as completed Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants