Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes an "Uncaught RangeError: Maximum call stack size exceeded" error? (Chrome, in other browsers other message)

Culdn`t find what makes that error, and how to find a solution...

Working under project:

http://atlas.sitegist.net/business/atlas/?l=en&h=6dff16b6f593384662cb24d66142047a

In project i show different data with integer values, and all that also shown on a map. When i added another visualisation of new data set, error occurs.

Testing information:

Mostly i must do some events in UI, and of course doing some mixing of listed under:

  • must click "Projects" button, and then check/uncheck checkboxes in toolbar section of my project
  • must click events on left sidebar panel (No need to expand collapse, for given data set selection of objects is made by choosing on of the parents)

Sometimes error ocuurs in 5 min. Sometimes in first shot, but ostly in 3-4 UI request.

the link above reproduce an error from start, or by 2-3 event triggers.

Errors: Copy paste from console

And such error i have in Chrome console:

Uncaught RangeError: Maximum call stack size exceeded
H.get
(anonymous function)
Mu.(anonymous function).zoomRange_changed
yf
H.set
(anonymous function)
Mu.(anonymous function).zoomRange_changed
yf
H.set
(anonymous function)
Mu.(anonymous function).zoomRange_changed
yf
...
H.set
(anonymous function)
Mu.(anonymous function).zoomRange_changed
yf

And onother one:

<error>
(anonymous function)
$
nm
Du
H.bf
H.mapType_changed
yf
H.set
H.aa
Tg.(anonymous function).J
(anonymous function)
Q.trigger
H.aa
Tg.(anonymous function).J
(anonymous function)
Q.trigger
H.aa
Tg.(anonymous function).J
(anonymous function)
Q.trigger
H.aa
...
H.aa
Tg.(anonymous function).J
(anonymous function)
Q.trigger

Solution under solution didn nott helped me, couse of lack of information about I.set and also I don`t use "Gmaps4rails":

Gmaps4rails Maximum call stack size exceeded?

like image 438
Roman M. Koss Avatar asked Sep 14 '12 14:09

Roman M. Koss


People also ask

How do you fix RangeError maximum call stack size exceeded?

Non-Terminating Recursive Functions When you call a recursive function, again and again, this limit is exceeded and the error is displayed. So, call recursive functions carefully so that they terminate after a certain condition is met. This will prevent the maximum call stack to overflow and the error will not pop up.

How do you find the uncaught RangeError maximum call stack size exceeded?

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.


1 Answers

Solved!!!

I found a problem in my bounds variable.

When i receiving JSON from server, while parsing it, the code makes bound from each location on a map.

// renew map bounds each time when new query comes
bounds = new google.maps.LatLngBounds ();
...
for (var key in data.locations ) {
    ...
    // For fitting in Bounds, we push the positions of each location
    atlas.Map.vars.bounds.extend ( new google.maps.LatLng(
        data.locations [key].lat,
        data.locations [key].lng
    ) );    
    ...
}
...
GoogleMap.fitBounds (bounds);

And somehow for the new data type it`s making browser stack to overflow.

(what is very strange, cause it works normal for a even a lot bigier results! (600< elements on a map)).

Made a brute code for fast result:

bounds = new google.maps.LatLngBounds ();
if( KMLLayer.poly.docs[0].bounds != undefined ) {
    bounds.extend( KMLLayer.poly.docs[0].bounds.getNorthEast() );
    bounds.extend( KMLLayer.poly.docs[0].bounds.getSouthWest() );
}
if( KMLLayer.marks.docs[0].bounds != undefined ) {
    bounds.extend( KMLLayer.marks.docs[0].bounds.getNorthEast() );
    bounds.extend( KMLLayer.marks.docs[0].bounds.getSouthWest() );
}
GoogleMap.fitBounds (bounds);

I have two KML layers, so i retrieved bounds, if there occurs some, from GeoXML3 layers.

Damn, i spend for it 6 hours and 38 minutes!!!

Maybe i was wrong with this line, what clears global variable badly:

bounds = new google.maps.LatLngBounds ();

original name of variables are litle longer :) bounds === atlas.Map.vars.bounds;

like image 99
Roman M. Koss Avatar answered Sep 22 '22 05:09

Roman M. Koss