Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Asynchronism between style and render style causing rendering failures in still mode #9868

Closed

Description

@brunoabinader

With #9689, we're adding an option for recycling the map object when running our render tests. These should be all passing now, except that occasionally you'll get at least one of the geojson/external-* render tests to fail.

When these tests fail, you can see from the rendering results that the test is using geometry data from a previous test run e.g. if the last test run was geojson/external-failure and the current one is geojson/external-invalid, you'll occasionally get the rendering result from external-failure in external-invalid.

Here's my understanding of the GeoJSON source workflow so far:

In still mode, there are multiple calls for Map::Impl::update, and each call creates a new UpdateParameters object which contains, among other things, data from all the style's sources implementations. These calls triggers the renderer frontend to eventually invalidate the renderer and force it to render, using the last-received UpdateParameters. We have safeguards in the renderer implementation that checks whether both the style and render style are loaded before notifying the still image requester that we ended up rendering. For a style to be loaded, we need all its sources to be also in loaded state - and in the case of GeoJSONSource, when its data is set via setUrl, it only goes to loaded state after receiving a reply from the file source request for that given URL (notifying the style via onSourceLoaded).

However, for some unknown reason, we're either not rendering the last-received UpdateParameters or failing to notify the renderer that the render style data needs to be updated.

Activity

  1. added
    Core
    Node.js
    on Aug 25, 2017
  2. brunoabinader commented on Aug 25, 2017

    @brunoabinader
    ContributorAuthor

    In case you're curious, so far the way I found for reproducing the rendering failure is to retry these render tests until they fail (remember you need the branch from #9689):

    true; while [ $? -eq 0 ]; do node platform/node/test/render.test.js --recycle-map "geojson/external"; done

  3. jfirebaugh commented on Aug 25, 2017

    @jfirebaugh
    Contributor

    Tricky. My first hunch was that this would fix it:

    ~/Development/mapbox-gl-native $ git diff --no-ext-diff
    diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
    index e255c5d0a..891f230f3 100644
    --- a/src/mbgl/map/map.cpp
    +++ b/src/mbgl/map/map.cpp
    @@ -48,6 +48,8 @@ public:
     
         ~Impl();
     
    +    bool isFullyLoaded() const;
    +
         // StyleObserver
         void onSourceChanged(style::Source&) override;
         void onUpdate(Update) override;
    @@ -203,7 +205,7 @@ void Map::Impl::onDidFinishRenderingFrame(RenderMode renderMode, bool needsRepai
             if (needsRepaint || transform.inTransition()) {
                 onUpdate(Update::Repaint);
             }
    -    } else if (stillImageRequest && rendererFullyLoaded) {
    +    } else if (stillImageRequest && isFullyLoaded()) {
             auto request = std::move(stillImageRequest);
             request->callback(nullptr);
         }
    @@ -682,7 +684,11 @@ uint8_t Map::getPrefetchZoomDelta() const {
     }
     
     bool Map::isFullyLoaded() const {
    -    return impl->style->impl->isLoaded() && impl->rendererFullyLoaded;
    +    return impl->isFullyLoaded();
    +}
    +
    +bool Map::Impl::isFullyLoaded() const {
    +    return style->impl->isLoaded() && rendererFullyLoaded;
     }
     
     void Map::Impl::onSourceChanged(style::Source& source) {

    But it doesn't.

    Will probably require some printf instrumentation to track down.

  4. brunoabinader commented on Aug 30, 2017

    @brunoabinader
    ContributorAuthor

    Fixed by #9883.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreNode.jsbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions