Troubleshooting Uncaught RangeError: Maximum call stack size exceeded

I only get this error in Safari and Chrome browser on Mac, but I can't reproduce it in other browsers or Windows. The main problem is there is no information about which function caused the problem. No stack trace with the most recent calls before the exception. And even the "Pause on Exceptions" setting doesn't work. It didn't stop at this exception, it only puts information in the console.

How can I troubleshoot the cause of the problem, what function it triggered, what is the call stack before the failure? Or how can I log all the function calls (it is important to note that the profiler should run right after the page loads).

+3


source to share


1 answer


I was able to find the point that was causing the error, so here are some tips for those who run into the same problem:



  • console.log is your friend. I haven't found an option in Google Chrome that will keep track of all method calls that start right after the page has loaded. Even if there is such a setting, the number of calls that you see can be very massive. This way you can use console.log to log when one of your functions is called.
  • Commenting out parts of the code . In my case the js file was really huge and it was helpful to find at least some of the code causing the error. So I started by writing the code safely piece by piece.
  • Using the technique above, I found that the problem was in obfuscated code, so the next thing I tried was to disable the obfuscation options one at a time . With this approach, I found that the problem occurred when the "trim line" option was enabled. Also I found these issues on code.google.com chrome 446047 and 56588 .
+1


source







All Articles