CesiumGS / CesiumGS/cesium

Race condition in `Cesium3DTileset.memoryAdjustedScreenSpaceError`

Open
#11,447 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

category - 3d tiles category - doc category - memory/performance
Dominant language
JavaScript
Stars
15.8k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

If a Cesium3DTileset is constructed with maximumCacheOverflowBytes: 0, it is possible for the screen space error adjustment to enter an infinite loop.

There are two adjustments to the screen space error that can happen depending on the current memory usage of the tileset (see https://github.com/CesiumGS/cesium/pull/11310):

  1. When Cesium3DTileset.totalMemoryUsageInBytes increases above cacheBytes + maximumCacheOverflowBytes, the memoryAdjustedScreenSpaceErrror will be increased until the requested tiles use less than cacheBytes + maximumCacheOverflowBytes
  2. When memory usage drops below cacheBytes, then memoryAdjustedScreenSpaceError will be adjusted lower, until either (a) the requested tiles use more than cacheBytes, or (b) memoryAdjustedScreenSpaceError is equal to the user-defined maximumScreenSpaceError

If maximumCacheOverflowBytes is less than the size of one tile, then either adjustment can potentially trigger the other adjustment, resulting in an infinite loop.

At a minimum, we need to clarify the docs:

  • The doc for maximumCacheOverflowBytes should include some guidance on good minimum values
  • The read-only memoryAdjustedScreenSpaceError is important information for the user, and should be exposed and documented (it is currently set to private)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Cesium3DTileset implementation and the screen-space-error adjustments described in pull request 11310. Reproduce the issue with maximumCacheOverflowBytes set to 0 and verify that the adjustment terminates; done should also include guidance for maximumCacheOverflowBytes and public documentation for memoryAdjustedScreenSpaceError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.