Step limit exceeded error

128 views
Skip to first unread message

Emmanuel Kitsao

unread,
Feb 5, 2021, 10:49:02 AM2/5/21
to rapidp...@googlegroups.com

Hello

I'm getting step limit exceeded, stopping execution before entering ...

followed by child run for flow '<flow-id>' ended in error, ending execution

What is the cause of that and how do I fix/workaround it?

See attached image for more details

image.png

Rowan Seymour

unread,
Feb 5, 2021, 11:14:04 AM2/5/21
to Emmanuel Kitsao, rapidpro-dev
In the past, we prevented users from creating flows with loops - i.e. node A can't go to node B and then back to A if there isn't a wait in between. Now users are free to create whatever loops they want... but there's a limit on the number of steps you can take between nodes (default is 100, configurable in mailroom) to stop users starting infinite loops that never end. 

So you probably need to check your flow and see if you need some additional logic to break out of a loop.

-Rowan

--
You received this message because you are subscribed to the Google Groups "rapidpro-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rapidpro-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rapidpro-dev/CAAtOLxr3xtwyq0Rs8vRZLREF5CpjUwYDpKeUfHXhgH-DB6q9Rg%40mail.gmail.com.


--
Rowan Seymour | +593 979099233 | @rowanseymour

Emmanuel Kitsao

unread,
Feb 5, 2021, 11:40:35 AM2/5/21
to Rowan Seymour, rapidpro-dev
I see. In this case, we do not have it like that i.e. node A to B then A. Let me describe the scenario. 

Think of a household with members. We have a main flow that loops for each household member, getting them to a flow that does the question (~5) and answer before moving to the next. In the question answer flow. We definitely don't get to 100, unless I'm mistaken on what nodes means. Would splitting by expression twice using one variable be an issue?

Surprisingly the error occurs once in a number of runs.

Rowan Seymour

unread,
Feb 5, 2021, 11:44:36 AM2/5/21
to Emmanuel Kitsao, rapidpro-dev
I would recommend finding the FlowSession object for one of these runs and looking at the JSON blob stored at FlowSession.output. You can even paste the JSON into https://sessions.temba.io/ to help you interpret it.

That will tell you exactly what is happening in the flow and how many steps you are reaching. Also you could check the MaxStepsPerSprint config variable in Mailroom to see what value you are using.

-Rowan

Emmanuel Kitsao

unread,
Feb 5, 2021, 12:13:49 PM2/5/21
to Rowan Seymour, rapidpro-dev
No value set for MaxStepsPerSprint. What is recommended?

Rowan Seymour

unread,
Feb 5, 2021, 12:18:17 PM2/5/21
to Emmanuel Kitsao, rapidpro-dev
If there is no value set then you're using the default of 100, which is the recommended value.

-Rowan

Emmanuel Kitsao

unread,
Feb 5, 2021, 1:38:39 PM2/5/21
to Rowan Seymour, rapidpro-dev
Where do I find FlowSession.output?

Rowan Seymour

unread,
Feb 5, 2021, 2:51:13 PM2/5/21
to Emmanuel Kitsao, rapidpro-dev
Provided you're logged in as the superuser or a Customer Support user you'll see a link in the contact history beside any Entered Flow item.

Otherwise just get the run/session id and look it up in the database in flows_flowsession.output

-Rowan

Emmanuel Kitsao

unread,
Feb 8, 2021, 4:29:51 AM2/8/21
to Rowan Seymour, rapidpro-dev
Here is a shot. Can get more if needed. How many steps I am reaching?

image.png

Regards,


Emmanuel Kitsao | App Developer

Medic Mobile | +254 728 830 678

@Medic | Facebook


Join our community. Sign up for Medic Mobile's newsletter.

Emmanuel Kitsao

unread,
Feb 8, 2021, 4:49:12 AM2/8/21
to Rowan Seymour, rapidpro-dev
Also, given that we're using the recommended steps limit of 100, should we just increase the number to say 10,000?

Regards,


Emmanuel Kitsao | App Developer

Medic Mobile | +254 728 830 678

@Medic | Facebook


Join our community. Sign up for Medic Mobile's newsletter.

Rowan Seymour

unread,
Feb 8, 2021, 8:49:02 AM2/8/21
to Emmanuel Kitsao, rapidpro-dev
I don't know how your flows work but I would look at that session dump and determine is it all behaving as expected. If so then maybe your flows are sufficiently complex that you are hitting the 100 limit in flows that don't have infinite loops, and should increase it a bit. I would also take a second to understand why that limit exists - sessions are serialized and deserialized as JSON and written/read to/from the database. The more steps, the bigger those big blobs of JSON become which has an effect on performance. Also if you have users creating flows with infinite loops, do you want them to discover that after a flow has added tens of thousands of items to a contact's history or hundreds of items?

-Rowan

Emmanuel Kitsao

unread,
Feb 9, 2021, 6:11:43 AM2/9/21
to Rowan Seymour, rapidpro-dev
Thanks for that explanation. We definitely do not want that tragedy. Back to the basics...you mention that node A can't go to node B and then back to A if there isn't a wait in between. What role does a wait play regarding steps and sessions? I added a dummy wait after each contact in the loop and seemed to work fine to completion. Just trying to make sense of it.

Regards,


Emmanuel Kitsao | App Developer

Medic Mobile | +254 728 830 678

@Medic | Facebook


Join our community. Sign up for Medic Mobile's newsletter.

Rowan Seymour

unread,
Feb 9, 2021, 9:26:23 AM2/9/21
to Emmanuel Kitsao, rapidpro-dev
The rule about waits between nodes was enforced in the past when we didn't have a limit on steps. It meant you couldn't create a flow that would get stuck in a loop - unless that loop included a wait for input from the contact. A contact is unlikely to reply thousands of times to the same question so you're unlikely to keep iterating through that loop for long. But that prevented users from creating "for loop" logic in their flows - where there is some sort of check to make sure the loop eventually terminates. So we replaced that with just a limit on the number steps (each landing on a node is a step) just to make sure flows can get stuck in a loop and run forever.

-Rowan
Reply all
Reply to author
Forward
0 new messages