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

Fix Terrain Lockups in requestTileGeometry due to Promise Handling Inconsistencies #11630

Merged

Conversation

marcejohnson
Copy link
Contributor

@marcejohnson marcejohnson commented Nov 14, 2023

Context

We observed that complex terrains sometimes cause CesiumJS to lock up or freeze. This issue was traced back to inconsistencies in promise handling within the requestTileGeometry function, particularly when dealing with undefined promises.

Proposed Solution

In this PR, we've enhanced the promise handling mechanism within requestTileGeometry. The updated logic ensures proper handling of undefined returns, preventing a recursive code path leading to terrain lockups.

Demonstration

We have set up a private Sandcastle example to demonstrate the problem. This can be shared upon request.

Impact

This change is crucial for applications dealing with complex terrains. It enhances the stability of CesiumJS and eliminates a cause of freezes.

Related

Note: Thank you for looking at this. This PR is open for discussion and feedback from the Cesium community and maintainers.


Checklist

  • Compatibility with all supported browsers.
  • Tests pass, including coverage, release-tests, deploy, node-16, and lint.
  • CLA and CHANGES.md requirements are met.

@cesium-concierge
Copy link

cesium-concierge commented Nov 14, 2023

Thanks for the pull request @marcejohnson!

  • ✔️ Signed CLA found.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.

@ggetz
Copy link
Contributor

ggetz commented Nov 14, 2023

Thanks for the Pull Request @marcejohnson!

We have set up a private Sandcastle example to demonstrate the problem. This can be shared upon request.

Yes, this will help with testing. Please share this with support@cesium.com and/or gabby@cesium.com. Thanks!

@marcejohnson
Copy link
Contributor Author

Please share this with support@cesium.com and/or gabby@cesium.com. Thanks!

Done! I've sent the Sandcastle example to your email as requested, @ggetz. It demonstrates the intermittent lockup issue that the PR aims to address.

@marcejohnson
Copy link
Contributor Author

cesium-concierge asked:

❔ Unit tests were not updated.

  • Make sure you've [updated tests]

This PR addresses a break/fix without new features, emerging from specific terrains in integration tests. Existing unit tests suffice for current functionalities, so no new tests were added.

Copy link
Contributor

@ggetz ggetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @marcejohnson! Testing is working well on the dataset you supplied.

Here is an alternative data source I used for testing. This was a terrain dataset which helped us identify an issue with the previous attempted fix. The fix here does not cause any issues with loading that dataset 👍.

packages/engine/Source/Core/CesiumTerrainProvider.js Outdated Show resolved Hide resolved
@marcejohnson
Copy link
Contributor Author

@ggetz I made all the changes based upon your code review for implicit promise handling, committed these, resynced with the base branch, and re-tested against our private problem terrain. All thumbs up on our side! Please let me know if there's anything else needed.

Copy link
Contributor

@jjhembd jjhembd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick run-through of Gabby's testing Sandcastle, as well as the other Terrain-related Sandcastles. Everything works well on my machine.

Thanks @marcejohnson!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants