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

Roman M. Koss picture Roman M. Koss · Sep 14, 2012 · Viewed 22.1k times · Source

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?

Answer

Roman M. Koss picture Roman M. Koss · Apr 19, 2013

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;