-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ResourcesCachePathChangeCallback is sporadically not returning #14297
Comments
@arnekaiser tracked this down to the callback being GC'ed in some edge cases as it was wrapped internally by a weak reference. Solution for now is to avoid using an anonymous inner class but instead keeping a reference scoped to the outer class instead (this will prevent GC'ing it). That said, we should revisit how we implement callbacks to avoid behaviors as shown in OP. Some notes on this in #14515 (comment). |
The problem here is that the GC is non-deterministic and how we're storing Line 20 in d25ae1c
Line 77 in d25ae1c
OfflineManager e.g. Lines 226 to 254 in 0fcab65
In order to solve this we could:
Both seem that could be implemented without adding any breaking changes and could be included in a patch release. 👀 https://www.pacoworks.com/2016/07/26/dissecting-callbacks-a-murder-mystery/ |
your suggestions are valid @Guardiola31337 but they don't take in account that |
Sometimes the
ResourcesCachePathChangeCallback
is not returning. After some debugging I found out, that theFileUtils.OnCheckFileWritePermissionListener
is gone (null) in theFileUtils.CheckFileWritePermissionTask
. Looks like a strange JNI behavior.The problem occurs more often when the resources cache path should be changed directly after the initialization of Mapbox and also on older devices.
Steps to reproduce
Expected behavior
The cache path should be set every time.
Actual behavior
Sometimes the cache path isn't set and the callback doesn't return.
Configuration
Android versions: all
Device models: all
Mapbox SDK versions: 7.3.0
The text was updated successfully, but these errors were encountered: