mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

CustomGeometrySource's java peer assertions fail when source is removed #12551

Open LukasPaczos opened 6 years ago

LukasPaczos commented 6 years ago

Refs https://github.com/mapbox/mapbox-gl-native/pull/12517#pullrequestreview-142911111.

The java peer assertions for CustomGeometrySource::fetchTile and CustomGeometrySource::cancelTile can fail when we remove the source on the main thread but the requests are still being processed on worker threads.

Temporary workaround - a small delay between removing the layer and removing the source is enough for the worker threads to finish and then we can safely remove the source.

/cc @asheemmamoowala

stale[bot] commented 5 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

JesseCrocker commented 5 years ago

@LukasPaczos Can you tell me if this issue is being worked on? I'm a Mapbox enterprise customer, and this bug is currently blocking shipping my application.

JesseCrocker commented 5 years ago

This is probably not the right fix, but this commit does seem to fix the crashes: https://github.com/trailbehind/mapbox-gl-native/commit/a6c88145b61c0bc588c73c53d0735ce7667b5878

chloekraw commented 5 years ago

Thanks for the heads up @JesseCrocker. We'll look into this in next sprint, beginning next week.

LukasPaczos commented 5 years ago

Hey @JesseCrocker, thanks for a suggestion. We've considered that before but didn't pull the trigger because we had a general refactor in mind. Since that didn't happen and is not on a backlog, for now, we might implement this workaround.

bentomas commented 4 years ago

I'm not sure this is completely fixed. We have a custom geometry source with tiles that take 1-2 seconds to load. We also provide the ability to change the basemap style. If you change them quickly, or occasionally randomly, we are getting a crash with this error:

JNI DETECTED ERROR IN APPLICATION: can't call boolean com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.isCancelled(int, int, int) on null object
     in call to CallBooleanMethodV
     from void com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.nativeSetTileData(int, int, int, com.mapbox.geojson.FeatureCollection)

Through debugging, we're definitely getting this error after we've changed styles but when there are still tiles being generated.

Should I create a new issue for this?

andersoncanteiro commented 3 years ago

I am facing the same problem as @bentomas. I already tried the last version Android (9.6.0), but the problem still happening. Also I am enterprise user and I am not able to release the app because of this issue. Do you guys have any workaround or any news about how to fix this?

JNI DETECTED ERROR IN APPLICATION: can't call boolean com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.isCancelled(int, int, int) on null object
in call to CallBooleanMethodV
from void com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.nativeSetTileData(int, int, int, com.mapbox.geojson.FeatureCollection)