question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cesium 'Invalid array length' error in updateFrustums

See original GitHub issue

We’re having a complex issue with Cesium rendering. It only seems to occur in some applications on some machines with some versions, and we haven’t yet found the common factor.

We use Cesium b25 with a custom render loop which gives the trace, but the same error occurs with the default render loop (it’s just caught and logged differently). Basically, the error is the following:

Uncaught RangeError: Invalid array length       Scene.js:454
updateFrustums                                  Scene.js:454
createPotentiallyVisibleSet                     Scene.js:609
Scene.render                                    Scene.js:911
CesiumWidget.render                             CesiumWidget.js:539
Viewer.render                                   Viewer.js:728
(anonymous function)

I believe the issue doesn’t occur with b19, and the cause seems to be that the horizonDistance is MAX so the Occluder test returns false and the test in updateFrustum falls through to continue instead of setting the near value, thus near ends up equal to far and numFrustums is 0, which is illegal at some point. The render loop runs happily in the background, but fails as soon as we try to actually show the Cesium widget.

I can give you some more information if it helps, but I haven’t been working on this part and its growing like a weed with build systems and submodules and the like. Do you have any pointers that we might investigate?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
shuntercommented, Aug 4, 2014

Most of what you describe is already in place. Throughout Cesium, we check input parameters and throw DeveloperErrors when invalid data is passed into function. In the minified release build, these checks are removed. For that reason, we recommend developing against the unminified file to catch errors early.

In your particular example (passing a Cartographic to a function that expects a Cartesian), however, we don’t have a check for that case. We do check to make sure that the destination is defined, but nothing beyond that.

0reactions
aramkcommented, Aug 3, 2014

Thanks for that explanation. Generally we want bad programs to fail early. I suppose one way would be to ensure all public method contracts fail if provided with invalid arguments on construction. The benefit being that users can never feed in bad data. The disadvantage may be very negligible performance loss not worth mentioning, but also taking the time to add and maintain these checks. Another approach could be to use an assertion library and then disable this in production code during the build. I think it would be a huge advantage in cutting down the time taken to find and resolve these bugs, especially in larger codebases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"RangeError: Invalid array length at updateFrustums ... - GitHub
I am trying to implement the scaling of points by distance in both 3D and 2D. I cannot use the scaleByDistance property due...
Read more >
RangeError: Invalid Array Length (updateFrustums) - CesiumJS
Hello! Since b26 I'm experiencing an odd crash in Cesium: it often crashes with a "RangeError: invalid array length" message.
Read more >
Range Error: Invalid Array Length on Validated geoJson ...
The error doesn't get thrown until Cesium's render loop attempts to render all the objects, with a bad object included. The bad object...
Read more >
Range error: invalid array length - Google Groups
Hi, I'm trying to render entities in for loop: <script> var viewer = new Cesium.Viewer('cesiumContainer'); var pinBuilder = new Cesium.PinBuilder();
Read more >
Wasatch Backcountry Skiing Desktop Map
RangeError: Invalid array length RangeError: Invalid array length at updateFrustums (https://wbskiing.com/addins/cesium/Build/Cesium/Cesium.js:23:2828996) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found