flutter-maplibre-gl icon indicating copy to clipboard operation
flutter-maplibre-gl copied to clipboard

Example application is crashing when trying to download offline maps.

Open mindthefish opened this issue 3 years ago • 3 comments

Device: iPad Pro 12.9 (2020) running iPadOS 15.0.2 Flutter version 2.5.3 Dart version 2.14.4 Xcode 13.0, Build version 13A233 CocoaPods version 1.11.2

When trying to start a download, the application is crashing with the following error:

Region download progress 0.0
libc++abi: terminating with uncaught exception of type std::__1::regex_error
* thread #28, name = 'com.mapbox.mbgl.DatabaseFileSource', stop reason = signal SIGABRT
    frame #0: 0x00000001bb8e79c4 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1bb8e79c4 <+8>:  b.lo   0x1bb8e79e4               ; <+40>
    0x1bb8e79c8 <+12>: pacibsp
    0x1bb8e79cc <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1bb8e79d0 <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Lost connection to device.

mindthefish avatar Oct 25 '21 14:10 mindthefish

I was able to reproduce this on an Android emulator.

Relevant part of the error message:

abort_message: assertion "terminating with uncaught exception of type std::__ndk1::regex_error: The expression contained an invalid range in a {} expression." failed'

m0nac0 avatar Oct 25 '21 15:10 m0nac0

Any updates on this? I have the same error on Android device. Has anyone managed to download a region in maplibre_gl on Android?


E/libc++abi(26170): terminating with uncaught exception of type std::__ndk1::regex_error: The expression contained an invalid range in a {} expression.
F/libc    (26170): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 26301 (DatabaseFileSou), pid 26170 (mapboxglexample)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/x1sxeea/x1s:12/SP1A.210812.016/G981BXXSEFVF4:user/release-keys'
Revision: '22'
ABI: 'arm64'
Processor: '5'
Timestamp: 2022-08-16 17:49:06.008974851+0200
Process uptime: 34s
Cmdline: com.mapbox.mapboxglexample
pid: 26170, tid: 26301, name: DatabaseFileSou  >>> com.mapbox.mapboxglexample <<<
uid: 10816
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'terminating with uncaught exception of type std::__ndk1::regex_error: The expression contained an invalid range in a {} expression.'
    x0  0000000000000000  x1  00000000000066bd  x2  0000000000000006  x3  00000073ac2739f0
    x4  736f646277641f73  x5  736f646277641f73  x6  736f646277641f73  x7  7f7f7f7f7f7f7f7f
    x8  00000000000000f0  x9  0600e17d0d13e29a  x10 0000000000000000  x11 ffffff80fffffbdf
    x12 0000000000000001  x13 0000000062fbbc71  x14 0033b2314c0f1f00  x15 00006774f9d75fb8
    x16 00000076d793f058  x17 00000076d791c5c0  x18 000000731397c000  x19 000000000000663a
    x20 00000000000066bd  x21 00000000ffffffff  x22 ffffff80ffffffc8  x23 00000073ac273c40
    x24 00000073ac273b20  x25 00000073ac273b60  x26 00000073ac274408  x27 0000000000000018
    x28 00000073ac2743f0  x29 00000073ac273a70
    lr  00000076d78cf03c  sp  00000073ac2739d0  pc  00000076d78cf068  pst 0000000000000000
backtrace:
      #00 pc 0000000000051068  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 9f96e1e92e346f8dd579bdcb20b6c618)
      #01 pc 00000000002fc2a4  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #02 pc 00000000002fc3fc  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #03 pc 00000000002f99d4  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #04 pc 00000000002f9000  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #05 pc 00000000002f8f5c  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (__cxa_throw+112) (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #06 pc 000000000019886c  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #07 pc 000000000019869c  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #08 pc 000000000019b0a8  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #09 pc 0000000000197d54  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #10 pc 0000000000197a1c  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #11 pc 0000000000197134  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #12 pc 000000000021fc94  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #13 pc 000000000021f114  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #14 pc 00000000001af360  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #15 pc 00000000001aed94  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #16 pc 00000000002178f0  /data/app/~~HVht83ePnzUoOyQ4HBlnTQ==/com.mapbox.mapboxglexample-XZ533sfYxfiMp4m63FOanA==/base.apk!libmapbox-gl.so (BuildId: 9497fa822fb9ba0c8ff97671ad28c0232b4f7d1f)
      #17 pc 00000000000b3020  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: 9f96e1e92e346f8dd579bdcb20b6c618)
      #18 pc 000000000005288c  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 9f96e1e92e346f8dd579bdcb20b6c618)
Lost connection to device.

JanikoNaber avatar Aug 16 '22 15:08 JanikoNaber

After some debugging with https://github.com/maplibre/maplibre-gl-native sample, I can't say that it seems to be a problem in the used demo style ( https://demotiles.maplibre.org/style.json ). With a different style the Flutter example works fine. I tested it with the Maplibre gl native sample style "https://api.maptiler.com/maps/streets/style.json?key=${mapTilerKey}".

Result of the debugging session: The error occurs as soon as the download gets started by changing the state to active _offlineRegion!!.setDownloadState(OfflineRegion.STATE_ACTIVE) Unfortunately I was not able to find the actual download routine (used only the sample project), so I was not able to debug the download code directly. Next step would be to check the Maplibre gl native code to find what is wrong with the demo style.

JanikoNaber avatar Oct 17 '22 07:10 JanikoNaber

@JanikoNaber Thank you for taking the time to look into this! So if I understand correctly, this issue ONLY affects the demo style. Thus its not an actual issue in production, correct?

cc @mindthefish

m0nac0 avatar Nov 12 '22 12:11 m0nac0

@m0nac0 yes, the issue is somewhere in the demo style. Unfortunately I haven't had time to dig into the root cause. But, because the issue does not appear in my own style, this has currently not a this priority for me. For the production code / framework it's only an exception handling issue. In my opinion the issue can be closed.

Am Sa., 12. Nov. 2022 um 13:08 Uhr schrieb m0nac0 @.***

:

@JanikoNaber https://github.com/JanikoNaber Thank you for taking the time to look into this! So if I understand correctly, this issue ONLY affects the demo style. Thus its not an actual issue in production, correct?

cc @mindthefish https://github.com/mindthefish

— Reply to this email directly, view it on GitHub https://github.com/m0nac0/flutter-maplibre-gl/issues/39#issuecomment-1312465120, or unsubscribe https://github.com/notifications/unsubscribe-auth/APL6LOSMBFB63T3W24ST4MDWH6CDBANCNFSM5GVMDQYQ . You are receiving this because you were mentioned.Message ID: @.***>

JanikoNaber avatar Nov 13 '22 10:11 JanikoNaber

@JanikoNaber Great to hear, and thank you again for investigating this!

m0nac0 avatar Nov 13 '22 12:11 m0nac0

as for me offline doesn't work both in demo app as well as my app.
So as I run downloadOfflineRegion() function it doesn't trigger any events and pass successfully in a try - catch block really quick but later the app just stops working.
If its intended to work as described in [mapbox docs](https://docs.mapbox.com/help/troubleshooting/mobile-offline/) the function doesn't provide any .json file.
I've checked the file "mbgl-offline.db" (that in my understanding supposed to hold uploaded tiles, correct me if Im wrong) and it has just region and its definition in a table but no uploaded tiles/layers/resources

I got the problem. So such behaviour is when one downloads more than 6000 tiles There is no error thrown that its too much tiles to upload so its silently crashes the app If one meets restrictions the offline functionality works well I am just leaving this comment here so if anyone face the same issue he can find out

gerripro avatar Nov 28 '22 17:11 gerripro