maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.19k stars 632 forks source link

Many styles caused RangeError: Maximum call stack size exceeded. #300

Open lixiaowei7 opened 6 years ago

lixiaowei7 commented 6 years ago

In my tileserver's config.json, there is about 600 styles. Then it caesed RangeError: Maximum call stack size exceeded, when I use the vector in my browser. I find that the max number of sytles is about 360. Is there any way to solve it?

Error Msg:

RangeError: Maximum call stack size exceeded
    at String.substr (native)
    at next (/root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/router/index.js:190:47)
    at Layer.handle [as handle_request] (/root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/router/layer.js:97:5)
    at trim_prefix (/root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/router/index.js:317:13)
    at /root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/router/index.js:335:12)
    at next (/root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/router/index.js:275:10)
    at /root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/application.js:233:9
    at /root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/router/index.js:635:15
    at next (/root/.nvm/versions/node/v6.0.0/lib/node_modules/tileserver-gl-light/node_modules/express/lib/router/index.js:260:14)
strech345 commented 4 years ago

I also had these Problemens. For me it look like it is a problem of the source count ( ~350 sources). styles didnt change and most of sources are not used inside styles.

AlbaraaKhayat commented 4 years ago

Simply increasing node stack size solves this issue, as explained here: https://stackoverflow.com/a/44398946/8337776