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.

Mapbox freezes after reaching download tile limit #8645

Closed

Description

@t4keda

I have an issue with offline maps,
when downloading a large offline map (over tile limit), when the download reaches tile size limit I try to list offline regions or delete the offline region I was trying to download, the callback of OflineRegion.delete() is never called and the region is never deleted. Also if I navigate to a new activity with a map, the app freezes initializing the map.

I've been able to reproduce the issue with the test app following these steps:

  1. Replace the code on mapboxTileCountLimitExceeded in OfflineActivity.java, line 291 with this code:
@Override
      public void mapboxTileCountLimitExceeded(long limit) {
        Timber.e("Mapbox tile count limit exceeded: " + limit);
        offlineRegion.delete(new OfflineRegion.OfflineRegionDeleteCallback() {
          @Override
          public void onDelete() {
            
          }

          @Override
          public void onError(String error) {

          }
        });
      }
  1. Download a large offline region
  2. Navigate to another activity with a map after the download reaches the tile limit

Platform: android
Mapbox SDK version: 5.0.2

Activity

  1. added
    Android
    on Apr 5, 2017
  2. added this to the android-v5.1.0 milestone on Apr 19, 2017
  3. modified the milestones: , android-v5.1.0 on May 8, 2017
  4. Guardiola31337 commented on May 9, 2017

    @Guardiola31337
    Contributor

    @t4keda thank you for reaching out and reporting your problem. Trying to download a really large area I'm getting #8784 so mapboxTileCountLimitExceeded is not fired.
    Could you add some more information for reproducing the issue? Are you able to provide any logs? Do you see Timber.e("Mapbox tile count limit exceeded: " + limit); message in the console?

  5. t4keda commented on May 15, 2017

    @t4keda
    Author

    @Guardiola31337 I have just tried with the latests commits in master and I can reproduce the issue: the timber message fires in the console and if I navigate from offlineActivity to another activity with a map on it the app hangs up.
    LeakCanary warns me about a memory leak, but I can't get the log because it complains it doesn't have the required permissions, but, if I install the test app and before I try to download the offline region I grant the app the permissions it needs, I get this crash when downloading the area:

    05-15 16:27:01.115 21404-21404/com.mapbox.mapboxsdk.testapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                  Process: com.mapbox.mapboxsdk.testapp, PID: 21404
                                                                                  Theme: themes:{default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overlay:system}
                                                                                  java.lang.NullPointerException: Attempt to invoke interface method 'void com.mapbox.mapboxsdk.offline.OfflineRegion$OfflineRegionObserver.onStatusChanged(com.mapbox.mapboxsdk.offline.OfflineRegionStatus)' on a null object reference
                                                                                      at com.mapbox.mapboxsdk.offline.OfflineRegion$1$1.run(OfflineRegion.java:259)
                                                                                      at android.os.Handler.handleCallback(Handler.java:739)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5461)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

    This is the area I am using to reproduce the crash.
    screenshot_20170515-162317

  6. Guardiola31337 commented on May 18, 2017

    @Guardiola31337
    Contributor

    Thank you for the explanation @t4keda I finally managed to reproduce it.

    NullPointerException has been solved in #8919
    This landed in the release branch, still needs to be merged to master.

    ANR still happens after reaching tile count limit and trying to navigate between activities.

    It seems that something is still opened...
    What happens in core when the limit is exceeded @zugaldia? How downloading is closed in this case? I tried calling offlineRegion.setDownloadState(OfflineRegion.STATE_INACTIVE); explicitly when mapboxTileCountLimitExceeded callback is fired but the app freezes too...
    Any ideas?

  7. 13kz commented on Jul 7, 2017

    @13kz

    I recently reproduce libc error describe in #8784.
    Below my stacktrace:

    A/libc: /Volumes/Android/buildbot/src/android/ndk-r15-release/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:74: void abort_message(const char *, ...): assertion "terminating with uncaught exception of type std::bad_alloc: std::bad_alloc" failed

    I reproduce this by changing screen orientation a several times (10 max).
    I'm trying to investigate if leak memory in my application may cause this one.
    Mapbox version release 5.1.0

  8. removed this from the milestone on Dec 8, 2017
  9. kkaefer commented on Jan 24, 2018

    @kkaefer
    Member
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

    Androidoffline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions