long running microflow crashes without errors in log

I'm facing an issue where a microflow that runs for around half an hour crashed without logging any errors.   I added log messages at the start and end of the flow and those do show up in the log so it does manage to get to the end activity. However, the progress bar keeps running for a really long time after the end log pops up and eventually it shows the standard error message to the user.   The microflow has a lot of nested loops with a lot of sub microlfows that generates a NPE list that can get really long. After that the list get sorted by 6 sorting layers and then it gets committed with refresh in client enbled. Finally that list get associated with a main NPE object.   Because it doesn't log any errors I checked the browser console. There I found this error: VM53:1          POST https://myproject.mendixcloud.com/xas/ 504   504 means a timeout occured but I'm confused on what actually times out. Does the flow do something asynchronous that keeps running in the background after the flow reaches the end maybe?
1 answers

It sounds like you have started this from a web browser and (as you said) the connection has timed out.

One approach you could take is to move most of the processing to a queue so it runs in the background and is no longer dependent on the frontend. 

I see you are running Mendix 7, so you’d have to look at the Queue or ProcessQueue module. However, this is deprecated because Mendix 9 has this functionality built in with the Task Queue.

I would suggest upgrading your application to Mendix 9 and using Task Queue. If you do, it is essentially as simple as breaking out most of your functionality into a submicroflow and calling this while ticking the run in task queue option. 

You can find out more on the Task Queue on this page of the documentation.

Hope this helps.