Maximum call stack size exceeded Error

0
Hi, I am getting below exception when I execute a Java action in my microflow. Looks like there are some recursive calls inside this java action and is from third party module so I can’t modify its behavior. An error occurred while executing On click at actionButton7: Maximum call stack size exceeded Error: An error occurred while executing On click at actionButton7: Maximum call stack size exceeded     at http://localhost:8080/mxclientsystem/mxui/mxui.js?637303093344019852:73:274096     at ye (http://localhost:8080/mxclientsystem/mxui/mxui.js?637303093344019852:35:9155)     at r (http://localhost:8080/mxclientsystem/mxui/mxui.js?637303093344019852:35:9051)     at m (http://localhost:8080/mxclientsystem/mxui/mxui.js?637303093344019852:40:138208) I found from other forum questions to use Process Queue module for a similar issue reported by others.  My requirement is to show the response returned by the API to user immediately after the microflow execution completes. Is it possible to update the client after microflow configured in the queue completes its execution? or is there any better approach to fix the above issue? Note: Lazy loading of data will not help us because this specific functionality requires all the data of the input ID sent to API   
asked
4 answers
2

Hi Mohan,

You error message is created by mxui.js this is the browser client (JavaScript). Java actions and Microflow are server side. So are you looking for the problem in the right place? Client / Server?

Cheers, Andries

 

answered
2

To your process queue question:

It is not directly possible to give feedback to the user when a queued action is finished. The queued action is running in a system context. There is no connection to your user session.

You could build something dirty with the microflow timer widget. This widget can execute a microflow periodically from a page. After creating your queued action (or batch of queued actions), you could execute a microflow every second. This microflow could check if a finished flag on some JobHelper object you created is set. If so, it would show the message to the user.

You could also use a self refreshing template grid to show the progress of some action using a progress bar.

But be aware of the fact that this solution only works if your user stays on that page until the job is done.

answered
0

hi Mohan, 

did you find a solution for this problem ? 

 

answered
0

This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited.

How to fix 

Wrap your recursive function call into a -

  • setTimeout
  • setImmediate or
  • process.nextTick

Also, you can localize the issue by setting a breakpoint on RangeError type of exception , and then adjust the code appropriately. Moreover, you can managed to find the point that was causing the error by check the error details in the Chrome dev toolbar console , this will give you the functions in the call stack, and guide you towards the recursion that's causing the error.

 

answered