I am using a Direct Web Remoting (DWR) JavaScript library file and am getting an error only in Safari (desktop and iPad)
It says
Maximum call stack size exceeded.
What exactly does this error mean and does it stop processing completely?
Also any fix for Safari
browser (Actually on the iPad Safari
, it says
JS:execution exceeded timeout
which I am assuming is the same call stack issue)
The call stack is limited in size, and when it's exceeded, the RangeError is thrown. This can happen when a deeply nested function is called, or when a lot of new variables are created. The most common way to fix this error is to reduce the number of function calls, or to limit the number of variables that are created.
If you don't want to run npm install every time you change the NodeJS version, then I recommend you to use Node Version Manager to install multiple NodeJS versions on your local computer. You should be able to install all dependencies without the maximum call stack size exceeded error now.
Introduction. If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code. More specifically, the issue lies with the function calling on itself indefinitely.
The "RangeError: Maximum call stack size exceeded" error occurs when a function is called so many times that the invocations exceed the call stack limit. To solve the error, specify a base case that has to be met to exit the recursion.
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you hit the call stack limit.
This is almost always because of a recursive function with a base case that isn't being met.
Consider this code...
(function a() { a(); })();
Here is the stack after a handful of calls...
As you can see, the call stack grows until it hits a limit: the browser hardcoded stack size or memory exhaustion.
In order to fix it, ensure that your recursive function has a base case which is able to be met...
(function a(x) { // The following condition // is the base case. if ( ! x) { return; } a(--x); })(10);
You can sometimes get this if you accidentally import/embed the same JavaScript file twice, worth checking in your resources tab of the inspector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With