Skip to content
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

Cesium crashes when removing multiple dataSources #9154

Closed
icarter09 opened this issue Sep 15, 2020 · 17 comments
Closed

Cesium crashes when removing multiple dataSources #9154

icarter09 opened this issue Sep 15, 2020 · 17 comments

Comments

@icarter09
Copy link

Using CZML data sources to display satellites, I am able to remove one datasource from viewer.dataSources. But when I attempt to remove N datasources, Cesium fails. I have linked to this ticket which explains the exact issue I'm running into.

#7632

I'll try to create a Sandcastle example of this.

Browser: latest Chrome

Operating System: Windows 10

@thw0rted
Copy link
Contributor

It's very interesting that both of these issues include satellites. What primitives (graphics) are you using to visualize them? Maybe there's an infrequently-used graphic type that has cleanup bugs.

@icarter09
Copy link
Author

I believe the issue might reside with using polylines in the CZML. Both issues are displaying that in the stack trace and the application was working correctly before they were introduced into the CZML.

@OmarShehata
Copy link
Contributor

@icarter09 are you able to reproduce this in Sandcastle?

@icarter09
Copy link
Author

Currently I am not since I don't have access to the exact same CZML files by way of Sandcastle. Also I forgot mention that removing N dataSources works correctly for non-sat CZML files that I am using. Comparing the sat to the non-sat files, I am noticing the polylines being contained within the sat CZML files, while they are not contained in the non-sat CZML files.

@icarter09
Copy link
Author

Another point to note is that is also occurring with viewer.dataSources.removeAll().

@OmarShehata
Copy link
Contributor

Currently I am not since I don't have access to the exact same CZML files by way of Sandcastle

You can upload your CZML to Cesium ion (https://cesium.com/ion) and then you can use it in Sandcastle. You'll see a "Open complete code example" button under the asset preview window (as shown here https://cesium.com/docs/tutorials/import-photogrammetry/#visualizing).

@icarter09
Copy link
Author

@OmarShehata sorry but that isn't going to work for me due to work constraints. I'll have to come up with a test one and then use the steps you provided.

@icarter09
Copy link
Author

icarter09 commented Nov 6, 2020

Any update on this issue? I've updated to Cesium 1.74 and still experiencing this issue. As previously stated, I'm unable to provide the CZML files. I've also pinpointed the issue to being related to polylines associated within a given CZML.

Update: I have also pinpointed the issue only occurs when two of the CZML files (dataSources) both have polylines associated with them.

Test cases:
A) One CZML file with polylines being removed => WORKS
B) One CZML without polylines being removed => WORKS
C) One CZML with polylines and another CZML file without polylines and both are being removed => WORKS
D) One CZML with polylines and another CZML file with polylines and both are being removed => FAIL

@icarter09
Copy link
Author

icarter09 commented Feb 7, 2021

@OmarShehata an example of the issue at hand has been provided on #7632

@Trylor
Copy link

Trylor commented Feb 8, 2021

Any update on this issue? I've updated to Cesium 1.74 and still experiencing this issue. As previously stated, I'm unable to provide the CZML files. I've also pinpointed the issue to being related to polylines associated within a given CZML.

Update: I have also pinpointed the issue only occurs when two of the CZML files (dataSources) both have polylines associated with them.

Test cases:
A) One CZML file with polylines being removed => WORKS
B) One CZML without polylines being removed => WORKS
C) One CZML with polylines and another CZML file without polylines and both are being removed => WORKS
D) One CZML with polylines and another CZML file with polylines and both are being removed => FAIL

I found @icarter09's observation to be true. remove() and removeAll() only fail when two CZMLs have been added to where both have poylines. @icarter09 have you found a workaround? I need to finish updates to my application and this is a blocker.

@icarter09
Copy link
Author

icarter09 commented Feb 8, 2021

@Trylor A work around that I have found is wrap the logic in a timeout to hide all the given entities for the given dataSource you are looking to remove. Then set that entities._entityCollection._entities array to an empty array. The timeout should allow you to iterate over all the dataSources. That should also allow you to track future dataSources based upon if they have values in the array you emptied out.

The issue here is that the dataSources keep adding on, but since remove() and removeAll() aren't working. This is about as good a hack as I could come up with.

@Trylor
Copy link

Trylor commented Feb 8, 2021

@icarter09 Thanks! I was just about to try a variation of that and then I saw your comment. Hopefully, this bug gets fixed soon.

@ezze
Copy link
Contributor

ezze commented Mar 29, 2021

I guess, I faced the same weird issue and get the same error:

react_devtools_backend.js:2430 An error occurred while rendering.  Rendering has stopped.
DeveloperError: This object was destroyed, i.e., destroy() was called.
Error
    at new DeveloperError (http://localhost:33331/cesium/Cesium.js:83:13)
    at PolylineCollection.throwOnDestroyed (http://localhost:33331/cesium/Cesium.js:32331:13)
    at PrimitiveCollection.update (http://localhost:33331/cesium/Cesium.js:194447:21)
    at PrimitiveCollection.update (http://localhost:33331/cesium/Cesium.js:194447:21)
    at PrimitiveCollection.update (http://localhost:33331/cesium/Cesium.js:194447:21)
    at updateAndRenderPrimitives (http://localhost:33331/cesium/Cesium.js:280406:23)
    at executeCommandsInViewport (http://localhost:33331/cesium/Cesium.js:280181:7)
    at Scene.updateAndExecuteCommands (http://localhost:33331/cesium/Cesium.js:279924:7)
    at render (http://localhost:33331/cesium/Cesium.js:280800:11)
    at tryAndCatchError (http://localhost:33331/cesium/Cesium.js:280819:7)

And I can confirm that it happens when at least two CZMLs having polylines are in data sources. The error is thrown for me even if the only one of them is removed. Unfortunatelly, I can't reproduce it in a mini repo yet. Need to investigate more to narrow down the problem.

@ezze
Copy link
Contributor

ezze commented Mar 29, 2021

@OmarShehata, thanks to @Trylor we already have the issue reproduced in Sandcastle.

@ezze
Copy link
Contributor

ezze commented Mar 29, 2021

After few hours of investigation things didn't become clear for me but let me write down what I get in hope it will help someone to solve the problem:

  1. I copied example of @Trylor from Sandcastle, ran it locally and...everything works without errors (like my own simple example in mini reproduction repository).
  2. In my project where I experience the problem I use Webpack, and unminified version of Cesium is used in the bundle for development. Now I decided to switch to minified version of Cesium, and it works too — czml sources with polylines are removed without errors!
  3. At the beginning I tried to downgrade Cesium to 1.65.0 in the project, at the point when migration to ES had been done and all related issues had been solved. The problem was already there!

Given mentioned above it may be some kind of concurrency or Cesium transpilation related issue. @Trylor @icarter09 Which version of Cesium do you use, guys?

@Oceanestars
Copy link

Any update on this issue?

@jjhembd
Copy link
Contributor

jjhembd commented Feb 1, 2024

Resolved in #11640

@jjhembd jjhembd closed this as completed Feb 1, 2024
pupitetris pushed a commit to pupitetris/cesium-webxr that referenced this issue Mar 4, 2024
Remove PolylineCollections from the Scene before they are destroyed. This causes CesiumGS#7758 and CesiumGS#9154.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants