Troubleshooting Uncaught RangeError: Maximum call stack size exceeded - javascript

I am getting this error only in Safari and Chrome on Mac machine, but can't reproduce on other browsers nor on Windows.
The main problem - there is no information on what function caused the issue. No stack trace with most recent calls before the exception. And even the "Pause on exceptions" setting is not working. It's not paused on this exception, only puts the information to console.
How can I troubleshoot what is causing the issue, on what function it crashes, what was the call stack before crash?
Or how can I log all the function calls(important note, the profiler should be started immediately after page load).

I have managed to find the point that was causing the error, so here are some advises for those who will face a same issue:
console.log is your friend. I haven't found an option in Google chrome that will trace all methods calls starting immediately after page load. Even if there is such setting, the amount of calls you will see maybe really massive. So you can use console.log to log whenever one of your functions called.
Commenting out parts of the code. In my case the js file was really huge and it was helpfull to find at least the part of the code that was causing an error. So I started by safelly commenting out the code piece by piece.
Using technichs above I have found that the issue appeared in the obfuscated code, so next thing I tried was disabling obfuscation options one by one. With this approach I have found that issue appeared when enabling 'string splitting' obfuscation option. Also I have found these issues on a code.google.com chromium 446047 and 56588.

Related

Inspect page not working when trying to run the code

Recently when I try to open the inspect page from Vscode for the output for the JavaScript code the console page starts to freeze and it begins using up too much memory like up to 4gb. It even takes time to close the tab cause my laptop begins to freeze and it becomes really hot after that I don't know why.
I thought it was some problem with the browser so i changed to to Microsoft edge and I get the same problem and I even tried to reinstall both Vscode and chrome but I get the same problem.
Sometimes this error occurs if our code make repetitive call and call stack goes in deadlock condition. Just try running new simple application you can find that error will not occur.
Try to find out which piece of code making that call again and again
In chrome developer tool you can see call stack also for better understanding.

Perform action before Chrome closes itself

I'm working on Chrome extension which needs to perform an action just before Chrome closes. Is there any method like chrome.window.onClose.addListener(...), or chrome.runtime.onClose.addListener(...) to ensure that something will be done and then chrome will close itself?
I've been struggling with this problem for two weeks. Here are the options for potential solutions that I've found, but they didn't work.
My investigation results:
Using function: chrome.runtime.onSuspend.addListener(...) - I don't know why, but it doesn't work at all for me. For example, I've tried to write a callback for this event, which tries to add hardcoded data to the indexed DB, but it doesn't add it. Description of this method even says that the callback is not guaranteed to be completed. OnSuspend documentation
Sent to the event page just before it is unloaded. This gives the extension opportunity to do some cleanup. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete.
Chrome working in a background - with this option my extensions seems to work, but... only on Windows older than Windows 10. I've checked few options and on my other computer, which has Windows 7 installed, processes connected to Chrome are closing more slowly, which gives time for my extension to perform necessary tasks. Unfortunately, Windows 10 kills all the processes much faster. I've check option "continue running background apps when google chrome is closed", but it doesn't change anything. I've also enabled flag "#enable-push-api-background-mode", it hasn't helped either.
Keep Chrome running in the background on Win10, Enable flag to keep Chrome processes running
chrome.app.window.current().onClosed - I've found a similar question on Stack Overflow, and one of the answers was the code mentioned above. The problem is when I try to type chrome.app.win... inside console, it doesn't show any suggestions both in background script and content script. Google's documentation doesn't mention any permission that I've to add inside my manifest.json to get access to this functionality.Stack Overflow similar question, Google's documentation about chrome.app
Methods build in web browser - I've thought that method window.onclose might be useful in my case. I've performed the same test as for chrome.runtime.onSuspend, but the result was exactly the same. Documentation
I've stuck and haven't got any idea how to solve my problem. Maybe I missed something important? Hope you will help me.

What does the "glGenSyncTokenCHROMIUM" error mean?

I'm debugging a WebGL application, and the following error message pops up in my console, right after a call to compileShader() and getShaderInfoLog():
GL_INVALID_OPERATION : glGenSyncTokenCHROMIUM: fence sync must be flushed before generating sync token
I've searched teh interwebs for glGenSyncTokenCHROMIUM, with no avail.
(This error seems to be hardware-specific, as I can only reproduce it on a GT-I9505 when running Chrome)
What does this error mean, and/or how can I get more detailed information of what's going on?
It seems to be indeed device/GPU/driver problem. There's bug in Chromium bug tracker (by the way, you can provide your case to it).
There're several ways to get information and help on WebGL bugs. Besides StackOverflow, there is WebGL google group (browser developers also active in it). Bugtrackers may be helpful (you always can and should report bugs to developers). And, if you feel like it, Chrome and Firefox have excellent code search engines (ff, cr), more than once I've found answers to my questions there.

Website stopped working with Chrome version 32

I am the developer for a large enterprise website, after the upgrade to chrome 32 the website stopped working completely. I Get the 'aw snap' about the time we have to render most of the elements on the page.
Its a massive code base so i haven't been able to find what's causing it. Ive been booting chrome in debug mode and watching the logs there.
Wierd behavior:
1)If i disable flash it works, we are using swfobject with a flash library.
2)I sometimes see in the logs when it crashes "Uncaught RangeError: Maximum call stack size exceeded" so i must have a infinite loop, but its not a always thing.
3)If i refresh enough it will boot all the way up, and work for good until i kill tab and start over. But again thats a sometimes cause it may start the crash cycle again after a few refreshes.
4) I sometimes see the error "file_descriptor_set_posix.cc(22)] FileDescriptorSet destroyed with unconsumed descriptors" Which i think relates to a infinite loop in the rendering of the webpage which would relate to the maximum call stack exceeded error.
Does anyone know what has changed in Chrome Version 32 that would be a good starting place to find the bug?
Libraries used: SWFobject, Backbone, underscore, soundmanager.js
I dont know why this fixed it, or what chrome changed that caused the code to break but if anyone is interested in what we did to resolve the error i'll explain.
1) I made all events going out of swfobject and our swf code go directly to the Flash.js class we had to interface with flash. Before it was propagating through a Backbone.dispatcher to the flash class. That caused the aw snap error to go away.
2) We were using a datetime library called Moment.js version 2.2.0. It was the one throwing the maximum call stack error, after updating that to 2.3.0 it stopped. Would love to know what chrome changed to cause a infinite loop.
If anyone has info on what chrome changed between the two versions that caused either error, I would love the answer because its a bit scary fixing the symptoms but not knowing the cause.
chrome will open multi tasks in the task manager, and it is sensitive to many plugins
try the following
1- go to settings in chrome
2- open extentions
3- disable all the extensions that you can
4- close chrome
5- open task manager in windows
6- go to processes
7- close all the processes related to chrome
8- reopen chrome and check your problem again

Google Chrome: How to debug random "Maximum call stack size exceeded" errors

In a complex JavaScript app (with jQuery and Ember), the JavaScript will occasionally crash randomly, either during page load or when I perform an action on the page. The error is as follows (screenshot):
Uncaught RangeError: Maximum call stack size exceeded
Class.proto
Class.proto
...
... with several pages of Class.proto stack trace lines, but no source/line information whatsoever, even at the bottom of the trace.
I know that this points at infinite recursion, and this could conceivably happen in the event system, but there is no obvious starting point for me.
I've been able to reproduce this only in Chrome Canary (22.0.1209.0), not Chrome stable or Firefox. The app is not talking to any external service or making any Ajax requests.
Since it happens only occasionally, and with no discernible cause, and since there's no usable stack trace, I'm having trouble tracking down the cause.
My question: What can I do to debug this problem?
Enable 'Break on exceptions' in the Chrome Developer Toolbar. Use this icon in the footer of the toolbar on the Sources tab (there are 3 states!)
It should stop your code and you can see the stack!
Some browsers no longer have breakpoints for uncaught Maximum call stack size exceeded errors.
Thanks to #Split Your Infinity and others on the Chromium bug report, there is a decent debugging strategy for Chrome:
Error.stackTraceLimit = Infinity
Documented here: https://v8.dev/docs/stack-trace-api

Categories