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.

Unrecognized selector crash when suspending and removing MGLOfflinePack #6092

Closed

Description

@Jackhammer42

Platform: iOS 9.3.4
Mapbox SDK version: 3.3.1

Steps to trigger behavior

When I try to cancel the download of an MGLOfflinePack, i get this error:

-[NSTaggedPointerString offlineRegionStatusDidChange:]: unrecognized selector sent to instance 0xa0000000148344a4
2016-08-19 16:53:08.187 ChemPark[659:57661] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString offlineRegionStatusDidChange:]: unrecognized selector sent to instance 0xa0000000148344a4'
*** First throw call stack:
(0x181aa6db0 0x18110bf80 0x181aadc4c 0x181aaabec 0x1819a8c5c 0x100f484e4 0x102ba9a7c 0x102ba9a3c 0x102baf4e4 0x181a5cd50 0x181a5abb8 0x181984c50 0x18326c088 0x186c6e088 0x1002b1c70 0x1815228b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

I am using this code for the task:

let packs = MGLOfflineStorage.sharedOfflineStorage().packs

        for pack in packs! {

            pack.suspend()

            MGLOfflineStorage.sharedOfflineStorage().removePack(pack, withCompletionHandler: nil)

        }

It seems similar to #4394, except this issue only seems to happen if i cancel the download, not after successfully completing the download.

Expected behavior

I was hoping to stop the download.

Actual behavior

Crash

Activity

  1. added
    iOS
    macOS
    on Aug 19, 2016
  2. 1ec5 commented on Aug 19, 2016

    @1ec5
    Contributor

    Related to #5538.

  3. 1ec5 commented on Aug 19, 2016

    @1ec5
    Contributor

    Does the crash occur if you only remove the pack instead of canceling it? Removing the pack should cancel it automatically, if asynchronously.

  4. Jackhammer42 commented on Aug 22, 2016

    @Jackhammer42
    Author

    I tried

    let packs = MGLOfflineStorage.sharedOfflineStorage().packs
    
            for pack in packs! {
    
    
                MGLOfflineStorage.sharedOfflineStorage().removePack(pack, withCompletionHandler: nil)
    
            }
    

    Same crash, after a few starting and canceling cycles.

    When I trie

    let packs = MGLOfflineStorage.sharedOfflineStorage().packs
    
            for pack in packs! {
    
    
                let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
                dispatch_async(dispatch_get_global_queue(priority, 0)) {
    
                    MGLOfflineStorage.sharedOfflineStorage().removePack(pack, withCompletionHandler: nil)
                    dispatch_async(dispatch_get_main_queue()) {
    
                    }
                }
    
    
    
    
             }
    

    It seems to work for a little more starting a canceling cycles, but it crashes in the end as well.

  5. marceln commented on Mar 28, 2017

    @marceln

    This isn't fixed in any of the latest versions, right?

  6. 1ec5 commented on Mar 29, 2017

    @1ec5
    Contributor

    #6186 should’ve made this crash less likely to occur; as a stale pointer issue, it’s difficult to say for sure that the crash is fixed.

  7. Jackhammer42 commented on Mar 30, 2017

    @Jackhammer42
    Author

    I will try to produce the error with the latest version and give you feedback about the result.

  8. Jackhammer42 commented on Apr 5, 2017

    @Jackhammer42
    Author

    sorry, still seeing this error :( (v. 3.5.0)

  9. added this to the ios-v3.6.0 milestone on Apr 5, 2017
  10. 1ec5 commented on Apr 5, 2017

    @1ec5
    Contributor

    MGLOfflinePack would really benefit from the sort of std::any usage being introduced to MGLStyleLayer and MGLSource in #8626 for #7375.

    /cc @boundsj @jfirebaugh

  11. modified the milestones: , ios-v3.6.0 on Jun 22, 2017
  12. removed this from the milestone on Sep 18, 2017
  13. georgejlee commented on Oct 18, 2017

    @georgejlee

    I have seen this crash as well. I am on Mapbox-iOS-SDK-3.6.4. I've attached a stack trace. The line that crashes is [pack offlineRegionStatusDidChange:status];:

    void MBGLOfflineRegionObserver::statusChanged(mbgl::OfflineRegionStatus status) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [pack offlineRegionStatusDidChange:status];
        });
    }
    

    I have tried suspending the offline pack before removing as well as removing the offline pack without suspending, crashes occur in both cases. Can you help? This is one of the most frequent crashes in our app now.

    Unknown.txt

  14. georgejlee commented on Mar 6, 2018

    @georgejlee

    This is still happening for me on 3.7.0. Any updates on this? Thanks.

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

    crashiOSmacOSoffline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions