Hi,
We want to set up a service to generate random dummy data for our app. We are feeding into the service how may objects we want to create and the service should create these in a runtime data source then do some rule based modifications before persisting.
Setting up this action on the client/app we’re allowed to set how many copies we want but in Services that’s not an option on Create Object action node. So we though the best way would be with an while loop that iterates x number of times and creates a new object on each iteration. But when testing this simple logic (trying to create 5 objects), the service freezes on its last iteration before producing 502 (Bad Gateway) in the console logger.
The loop increments a variable used in the while-loop condition, so no it’s not an infinite loop.
Here’s a screen of the logic. What we see is that every last run provides a modification (Update object) before the logic “shuts down” and throws a 503 error in the console logger.
There is no general issue on this one. Many services are running in Production with While-loops working, and I also just set up a similar case as your screenshot.
What we’ve seen is that is is related to memory, so I guess there is some heavy machinery going on (not necessarily the while-loop itself). Is this happening in Dev, Test or Production environment? I guess a DM is better in this case.
Did some more debugging now and there was a infinite loop further down the code that was the issue. What threw me off was that the console logger stopped logging halfway through the last iteration in the first while-loop, skipping all code blocks before the infinite loop. This makes it more difficult to see where the issue resides.
Here’s the action steps if you want to reproduce.
A while loop (as seen above): Logged all steps until last iteration
A sequential block: Not seen in Console logger
– A Sort objects action node: Not seen in Console logger
– The infinite loop: Not seen in Console logger