Terrain availability race condition #11296
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
requestTileGeometry
returns an error whenlayerToUse
for that particular tile isundefined
. Doing so marks the entire tile as failed, which means it does not ever get re-requested.This is fine when we know all the tile availability up-front. In that case, the error is valid.
However, when cut-out terrain is used, it's possible to not know the availability for different layers at the time of request. The existing logic skipped over any layer with unknown availability for that tile, and if there were no other valid layers, then this tile was marked as failed.
This PR adjust things so that we don't continue with the request unless:
We can't do an early return in
requestTileGeometry
when availability is unknown or the tiles get re-requested too quickly and block other valid requests, ultimately leading to stalling.checkLayer
caches results to prevent repeat requests, so its not problematic to call in quick succession.This problem only really becomes apparent when there are a lot of layers with competing requests to get availability data.
@mramato Can you take a look?