-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering stops with "TypeError: Cannot read properties of undefined (reading 'rectangles')" or "TypeError: node is undefined" #11769
Comments
For what it's worth, this bug seems to happen primarily with the Cesium World Terrain. When I use locally hosted terrain, this doesn't happen even if I get the occasional 404 error for a terrain tile at a certain level. |
@ethanchristensen01 Could you please provide your build configuration from before and after? @jjspace Can you please take a look at this given that it seems to arise when switching from webpack to vite? |
@ggetz @jjspace Here is a gist containing the old and new config files At some point, we tried using vite-plugin-cesium instead of vite-plugin-static-copy, but this error was still occurring. |
I've updated the gist I shared earlier to include a file which creates the viewer like how I'm doing it. It's an unusual way of doing it, so that might be worth checking out. |
@ethanchristensen01 My guess is something when wrong with the terrain tile request. Our recommended vite configuration has some additional options which may be factor. @jjspace Can you take a look at this given the vite tooling? |
@ggetz I've updated the vite config to reflect the recommended configuration, thank you for the pointer there. Changing that didn't seem to fix the bug. I did some more testing and found that having a lot of billboard entities (pins) in one location made the error happen more consistently. Switching from a secondary terrain provider to Ion will usually trigger the error. These pins are supposed to be clamped to the ground. Their positions also get updated every few seconds, during which we might be getting the altitude of the terrain at the new position with sampleTerrainMostDetailed. Tomorrow, I will test more with our old build to see if I can consistently break it there, too. |
@ethanchristensen01 Sorry updating the config didn't work. It sounds like this is possibly not be a vite/build issue? If you can consistently reproduce it in your project are you able to recreate it in a minimal Sandcastle example? |
@jjspace I've been troubleshooting this when I've had the time to. I narrowed down a single function where the error would consistently happen. This function accepts a After trying almost everything I could think of, I tried logging out HYPOTHESIS: Calling Unfortunately it's a little hard to set this up in Sandcastle. |
@ggetz With a better understanding of what happened in this issue, I don't think it's possible to prevent this from happening on the Cesium side. Developers will have to know not to put the Cesium viewer in a Proxy. You can decide to leave this issue open or closed, since my problem is solved. I created an issue in the Vue 3 migration guide repo vuejs/v3-migration-guide#63 as well. This requests documentation be added to warn users about async race conditions when making complex class instances reactive. |
@ethanchristensen01 I'm definitely glad you found a solution to the issue! That said it sounds like this is an issue outside of Cesium itself and, as you said, I'm not sure we can do much about it.
This is really helpful to know and we'll definitely keep it in mind if we see more people with similar issues. Thanks for sharing your investigations! I'm going to close this for now as there's no further action at this time. If we see this reported often we may add some documentation somewhere but that can be assessed in the future. |
What happened?
Cesium sometimes unexpectedly crashes with this message when I pan the map or zoom with my mouse. It started when I tried migrating my project from vue 2 + webpack to vue 3 + vite.
Firefox stack trace:
Chrome stack trace:
Reproduction steps
This bug is difficult to reproduce. It might be something I'm doing wrong with my codebase, but it's a little too big to pinpoint what exactly it could be right now. I do know we call
sampleTerrainMostDetailed
quite a bit.The relevant section of the cesium source code is here.
cesium/packages/engine/Source/Core/TileAvailability.js
Lines 446 to 463 in 9cf4839
It looks like it's trying to traverse up a tree via
node.parent
whilenode !== stopNode
(i.e. untilnode === stopNode
), but it never checks ifnode
is undefined. Ifnode
is undefined, that most likely means we already reached the root node. But why are we reaching the root node beforestopNode
?Does that mean the program is in a broken state? If so, there should be a specific error message explaining how the invariants have been invalidated and what might have caused it.
Is
node !== stopNode
the right comparison? We're comparing references here, not the contents of the object. If this is the problem, maybe we should implement aNode.isEquals
method or something.If the comparison is correct and the state is valid, maybe a simple undefined check would fix this.
Sandcastle example
No response
Environment
Browser: Chrome 120.0.6099.217 and Firefox 121.0.1
CesiumJS Version: 1.106.1 and 1.112.0
Operating System: Windows 10
Dev Server: Vite 5.0.6
The text was updated successfully, but these errors were encountered: