Closed (fixed)
Project:
Maestro
Version:
4.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
14 Oct 2025 at 16:02 UTC
Updated:
11 Nov 2025 at 14:54 UTC
Jump to comment: Most recent, Most recent file
Processes of the following Template will hang on "AndTask wait" forever.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | fix_regen_for_andtask.patch | 2.82 KB | luenemann |
| #4 | maestro.maestro_template.maestroandtask_in_a_loop.yml | 4.95 KB | luenemann |
| AndTask after loop never succeeds.PNG | 10.66 KB | luenemann |
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
luenemannI have a patch to fix this.
It is an issue with setting the regeneration flag on to many maestro_queue entities. In this case "Start"
I'd like to provide an automated test for this scenario.
Comment #3
_randy commentedOk while the engine shouldn't have an issue with this arrangement, I don't understand the purpose of the AND.
I think that validation should be expanded to include detection of AND pointing back to start. In fact, I think that no task should point back to start in general.
Comment #4
luenemannThank you for acknowledging that the workflow should have no issues.
This is a minimal workflow to demonstrate the issue.
I've tried to remove all unnecessary tasks. "dummy task1" is only there to make the pointers / arrows visible.
There can be more tasks anywhere and the problem persists.
The purpose of the AndTask is to wait for two parallel branches to finish.
The "AndTask wait" is not pointing back to start.
I've attached the template config and a patch to make the workflow run without issues.
There are some entity queries which can be optimized too. Should that be handled in this ore in a separate issue?
Comment #6
_randy commentedOK, I'll give the engine a test with the scenario you provided.
Curious to know why you changed the getValue to getString?We target the AND task specifically in the engine for this exact reason -- The AND execution does indeed check for <> TASK_ARCHIVE_REGEN, so I have to be very certain that including the <> 2 condition in the engine is the right thing to do here.
(For entity queries, that should be a separate issue, however, some queries were expanded on purpose for clarity in debugging)
Comment #7
_randy commentedIn testing this patch, I see a new issue happening where for some reason the IF task does not work properly -- it does not follow the TRUE path and as a result, the dummyTaskToFix... task is always generated on first pass through.
I agree on changing the getValue to getString. But the bigger issue is that the logic is broken with this approach.
I have to run it through some more of my local engine tests and come up with a different solution.
Comment #9
_randy commentedI've made a few small alterations to the logic. I've committed what I think is an update to the engine that will support the scenario you've noted and should keep the rest of the logic intact.
Comment #10
luenemannYour fix works as well. But i think it is confusing, especially with the comment above: "Race condition? ... Leave for now."
I did some git archaeology. The code appeared first in 2017. It looked like this:
status == active and archived == archivedis a condition which never matches. I interpret the comment as "This isn't working, somehow. So make it make it do nothing.The code below was dead, effectively.
I have an idea what the problem was.
You observed the following:
That is an effect of reusing the
$taskIDvariable in the loop over$pointers.$taskIDis used to generate the task:This is fixed with your latest commit.
Comment #11
luenemannI propose to remove the archive condition and the comment above.
I've created a merge request with my proposal and 2 test cases.
There is still an issue with the current logic. Because there needs to be a task between the
IfTaskand theAndTask. This is a limitation of the current data model. I think transitions between the tasks need to be recorded as well to resolve that problem. But that is for another issue.The merge request has 2 templates. One with and one without a workaround task.
The tests are working but there is definitively room for improvement.
Please review.
Comment #12
_randy commentedThanks, give me a bit of time to look at the MR and I'll get back to you.
Comment #13
_randy commentedI'll let you update the MR as I think https://www.drupal.org/project/maestro/issues/3552704#comment-16307445 will cover the AND issue you noted. This was in the wings for some time and now is a good time as any to update the AND logic and IF false branch status.
Comment #15
luenemannI've updated the tests.
Fixed a bug in commit #3552704-2: Update AND task for false branch detection
Comment #17
_randy commentedThanks for the MR! Let's update the test flow names and the need for the post-IF task to remove the word "workaround" and solidify those tests.
Comment #19
luenemannNR for [3552133-17]
Comment #20
luenemannWorkaround test removed.
Comment #21
luenemannComment #23
_randy commented