I have a workflow that almost consistently hangs when I edit it

Consistent hang when editing this workflow.

When I am working on this workflow, if I edit much of anything in the loop, the tab I’m working in hangs. I get a notification that n8n has stopped responding and my options are to wait or exit.

If I choose wait, the options come back after a timeout.

If I choose exit, any tabs I have open with n8n die, losing any edits I have not yet saved. Sometimes, it does not kill one or more other tabs.

Here is an image

Please share your workflow

Information on your n8n setup

  • n8n version: 1.38.2
  • Database (default: SQLite): PostgresQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker on DO
  • Operating system: Ubuntu 22.04.3 LTS

I think I may have figured out what’s going on. I’d like confirmation and how to avoid this.

In the Next Page node, I increment the page number with

{{ $('Set Body').item.json["pageNum"]++ }}

I found this by attempting to manually rebuild the node. When I got to the Next Page node, after I inserted the variable, I added “++” to it so it would increment. I immediately experienced the hang I described earlier.

Is there another method I should be using?

-Russ

I think this might solve your issue:

Yup, that will be a nice feature when I have time to work through it and figure out how it works. I have several legacy workflows that I will have to rewrite when that happens. Additionally, I have at least three different methods of pagination occuring.

I did take a look at it during some copious free time last week. It’s not as straight forward as I thought, especially when I have to calculate how many objects have been retrieved (page# * #ofObjectsPerRequest >= totalObjectsToPull), or “go until an empty page is returned”.

If your workflow processes a LOT of data, you should also consider reducing memory consumption by implementing part of your loop as a subworkflow, as explained here.

1 Like

Hi Bart,

The workflow I’m working with here is actually 9 workflows. The first calculates and retreives the API credentials and gets a list of organizations, then sends that data to a flow that processes each organization, one at a time.

Now we get to the heavy lifting.

The flow calls three subflows to pull all of the objects for that organization on three platforms. After getting these lists, it combines the lists into:

  1. In 1, but not 2
  2. In 2, but not 1
  3. In both 1 and 2
  4. In 2, but not 3
  5. in 3, but not 2
  6. In both 2 and 3
  7. In 1, but not 3
  8. In 3, but not 1
  9. In both 1 and 3

Then it processes each list accordingly.