Mapbox Implementation
Mapbox
Mapbox Version
11.8.0
React Native Version
0.76.0
Platform
iOS
@rnmapbox/maps version
10.1.33
Standalone component to reproduce
import React from 'react';
import {
MapView,
RasterSource,
RasterLayer,
Camera,
} from '@rnmapbox/maps';
class BugReportExample extends React.Component {
render() {
return (
<MapView style={{flex: 1}}>
<Camera centerCoordinate={[0,0]} zoomLevel={5} />
<RasterSource tileUrlTemplates={["any LOCAL ZXY path"]} tileSize={256}>
<RasterLayer
minZoomLevel={3}
maxZoomLevel={13}
/>
</RasterSource>
</MapView>
);
}
}
Observed behavior and steps to reproduce
- Run the app as many times possible and pan to load the tiles
- In very rare cases (3 per day in a production app with 5000 users), this stack trace will happen
OS Version: iOS 18.2 (22C152)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 10 **(This thread number is random every time)**
Application Specific Information:
*** error for object %p: pointer being freed was not allocated
> MyAppName > MyAppName(1724,0x16be8b000) malloc: *** error for object 0x3007949e0: pointer being freed was not allocated
Thread 10 Crashed:
0 libsystem_kernel.dylib 0x3b825e2d4 __pthread_kill
1 libsystem_pthread.dylib 0x42aca059c pthread_kill
2 libsystem_c.dylib 0x32525bb08 abort
3 libsystem_malloc.dylib 0x3361f8bdc <redacted>
4 libsystem_malloc.dylib 0x3361f8850 <redacted>
5 libsystem_malloc.dylib 0x3361f5dc4 <redacted>
6 libcache.dylib 0x466b21a8c cache_set_name
7 CoreFoundation 0x3156deb88 <redacted>
8 CoreUI 0x352495184 <redacted>
9 CoreUI 0x352490320 <redacted>
10 CoreUI 0x3524ab560 <redacted>
11 CoreUI 0x3524ab414 <redacted>
12 CoreUI 0x3524ab2e4 <redacted>
13 CoreUI 0x3524ab124 <redacted>
14 UIKitCore 0x31aa9546c <redacted>
15 UIKitCore 0x31a6e148c <redacted>
16 UIKitCore 0x31a6deff0 <redacted>
17 UIKitCore 0x31aa94954 <redacted>
18 UIKitCore 0x31aa94820 <redacted>
19 UIKitCore 0x31a6ddc8c <redacted>
20 UIKitCore 0x31a6dd778 <redacted>
21 UIKitCore 0x31aa94db0 <redacted>
22 UIKitCore 0x31a82f8ec <redacted>
23 MyAppName 0x204658188 RCTImageFromLocalAssetURL (RCTUtils.m:864)
24 MyAppName 0x2047a9164 -[RCTBundleAssetImageLoader loadImageForURL:size:scale:resizeMode:progressHandler:partialLoadHandler:completionHandler:] (RCTBundleAssetImageLoader.mm:52)
25 MyAppName 0x2047acc94 -[RCTImageLoader _loadImageOrDataWithURLRequest:size:scale:resizeMode:priority:attribution:progressBlock:partialLoadBlock:completionBlock:] (RCTImageLoader.mm:561)
26 MyAppName 0x2047aebe4 -[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:priority:attribution:progressBlock:partialLoadBlock:completionBlock:] (RCTImageLoader.mm:841)
27 MyAppName 0x2047ac090 -[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:priority:progressBlock:partialLoadBlock:completionBlock:] (RCTImageLoader.mm:373)
28 MyAppName 0x2047abf88 -[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:] (RCTImageLoader.mm:352)
29 MyAppName 0x204b3b67c RNMBXImageQueueOperation.start (RNMBXImageQueue.swift:72)
30 MyAppName 0x20450af68 thunk for closure
31 libdispatch.dylib 0x32515a248 <redacted>
32 libdispatch.dylib 0x32515bfa8 <redacted>
33 libdispatch.dylib 0x32515f0f4 <redacted>
34 libdispatch.dylib 0x32516dec0 <redacted>
35 libdispatch.dylib 0x32516e6c4 <redacted>
36 libsystem_pthread.dylib 0x42ac9b644 _pthread_wqthread
Thread 0
0 MapboxCoreMaps 0x105d871c4 mbgl::FillLayerFactory::getTypeInfo
1 MapboxCoreMaps 0x105cf7b94 mbgl::LayerManagerDefault::addLayerType
2 MapboxCoreMaps 0x105cf7664 mbgl::LayerManagerDefault::LayerManagerDefault
3 MapboxCoreMaps 0x106023fe4 mbgl::style::conversion::Converter<T>::operator()
4 MapboxCoreMaps 0x105c92e14 mapbox::maps::StyleManagerImpl::addStyleLayer
5 MapboxCoreMaps 0x105c1eb54 mapbox::maps::StyleManager::addPersistentStyleLayer
6 MapboxCoreMaps 0x105be1acc -[MBMStyleManager addPersistentStyleLayerForProperties:layerPosition:]
7 MapboxMaps 0x10716f9c0 MBMStyleManager
8 MapboxMaps 0x107166ee0 StyleManager.addPersistentLayer
9 MapboxMaps 0x10716b6bc handleExpected<T>
10 MapboxMaps 0x1071620c8 StyleManager.addLayer
11 MapboxMaps 0x107161f90 StyleManager.addPersistentLayer
12 MapboxMaps 0x1071686c8 StyleManager
13 MapboxMaps 0x1070dd418 AnnotationManagerImpl.init (AnnotationManagerImpl.swift:135)
14 MapboxMaps 0x1070c8acc PointAnnotationManager.init
15 MapboxMaps 0x106ea36b8 [inlined] PointAnnotationManager.init
16 MapboxMaps 0x106ea36b8 [inlined] PointAnnotationManager.__allocating_init (PointAnnotationManager.swift:36)
17 MapboxMaps 0x106ea36b8 [inlined] PointAnnotationManager (<compiler-generated>:30)
18 MapboxMaps 0x106ea36b8 AnnotationOrchestrator.make<T> (AnnotationOrchestrator.swift:154)
19 MapboxMaps 0x106ea21c8 [inlined] AnnotationOrchestrator.make<T>
20 MapboxMaps 0x106ea21c8 AnnotationOrchestrator.makePointAnnotationManager (AnnotationOrchestrator.swift:104)
21 MyAppName 0x204b6d98c RNMBXPointAnnotationManager.init (RNMBXMapView.swift:1594)
22 MyAppName 0x204b598d4 [inlined] RNMBXPointAnnotationManager.init
23 MyAppName 0x204b598d4 [inlined] RNMBXPointAnnotationManager.__allocating_init (RNMBXMapView.swift:1597)
24 MyAppName 0x204b598d4 [inlined] RNMBXMapView.pointAnnotationManager.getter (RNMBXMapView.swift:201)
25 MyAppName 0x204b598d4 RNMBXMapView.pointAnnotationManager.getter (RNMBXMapView.swift:200)
26 MyAppName 0x204b5ba04 RNMBXMapView.applyOnPress (RNMBXMapView.swift:1169)
27 MyAppName 0x204b5b328 RNMBXMapView.Property.apply (RNMBXMapView.swift:383)
28 MyAppName 0x204b740d0 [inlined] thunk for closure
29 MyAppName 0x204b740d0 thunk for closure
30 MyAppName 0x204b74470 thunk for closure
31 MyAppName 0x204b742f4 [inlined] thunk for closure
32 MyAppName 0x204b742f4 thunk for closure
33 MyAppName 0x204b742c0 [inlined] PropertyChanges.apply (PropertyChanges.swift:53)
34 MyAppName 0x204b742c0 [inlined] PropertyChanges.apply
35 MyAppName 0x204b742c0 PropertyChanges.apply
36 MyAppName 0x204b6d7d4 [inlined] thunk for closure
37 MyAppName 0x204b6d7d4 [inlined] thunk for closure
38 MyAppName 0x204b6d7d4 Sequence.forEach
39 MyAppName 0x204b6f3fc [inlined] Sequence.forEach
40 MyAppName 0x204b6f3fc [inlined] PropertyChanges.apply (PropertyChanges.swift:52)
41 MyAppName 0x204b6f3fc RNMBXMapView.didSetProps (RNMBXMapView.swift:752)
42 MyAppName 0x204b5fbf4 [inlined] RNMBXMapView.didSetProps
43 MyAppName 0x204b5fbf4 RNMBXMapView.didSetProps (<compiler-generated>:746)
44 MyAppName 0x204652714 __45-[RCTUIManager _dispatchPropsDidChangeEvents]_block_invoke (RCTUIManager.m:1263)
45 MyAppName 0x204651eac __44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke (RCTUIManager.m:1162)
46 MyAppName 0x204651fb0 __44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.144 (RCTUIManager.m:1182)
47 libdispatch.dylib 0x32515a248 <redacted>
48 libdispatch.dylib 0x32515bfa8 <redacted>
49 libdispatch.dylib 0x32516aa34 <redacted>
50 libdispatch.dylib 0x32516a64c _dispatch_main_queue_callback_4CF
51 CoreFoundation 0x315679bbc <redacted>
52 CoreFoundation 0x3156761b0 <redacted>
53 CoreFoundation 0x3156c8274 CFRunLoopRunSpecific
54 GraphicsServices 0x3afa214c0 GSEventRunModal
55 UIKitCore 0x31aa2677c <redacted>
56 UIKitCore 0x31a64ce64 UIApplicationMain
57 MyAppName 0x2044f01f0 main (main.m:8)
58 <unknown> 0x1b8cfcde8 <redacted>
Thread 1
0 libsystem_kernel.dylib 0x3b825359c __ulock_wait2
1 libsystem_platform.dylib 0x42ab41d9c <redacted>
2 UIKitCore 0x31a6dd6c0 <redacted>
3 UIKitCore 0x31a82f844 <redacted>
4 MyAppName 0x204658188 RCTImageFromLocalAssetURL (RCTUtils.m:864)
5 MyAppName 0x2047a9164 -[RCTBundleAssetImageLoader loadImageForURL:size:scale:resizeMode:progressHandler:partialLoadHandler:completionHandler:] (RCTBundleAssetImageLoader.mm:52)
6 MyAppName 0x2047acc94 -[RCTImageLoader _loadImageOrDataWithURLRequest:size:scale:resizeMode:priority:attribution:progressBlock:partialLoadBlock:completionBlock:] (RCTImageLoader.mm:561)
7 MyAppName 0x2047aebe4 -[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:priority:attribution:progressBlock:partialLoadBlock:completionBlock:] (RCTImageLoader.mm:841)
8 MyAppName 0x2047ac090 -[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:priority:progressBlock:partialLoadBlock:completionBlock:] (RCTImageLoader.mm:373)
9 MyAppName 0x2047abf88 -[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:] (RCTImageLoader.mm:352)
10 MyAppName 0x204b3b67c RNMBXImageQueueOperation.start (RNMBXImageQueue.swift:72)
11 MyAppName 0x20450af68 thunk for closure
12 libdispatch.dylib 0x32515a248 <redacted>
13 libdispatch.dylib 0x32515bfa8 <redacted>
14 libdispatch.dylib 0x32515f0f4 <redacted>
15 libdispatch.dylib 0x32516dec0 <redacted>
16 libdispatch.dylib 0x32516e6c4 <redacted>
17 libsystem_pthread.dylib 0x42ac9b644 _pthread_wqthread
Thread 2
...
<More 82 threads like Thread 1, all starting with RNMBXImageQueueOperation.start (RNMBXImageQueue.swift:72) and crashing on RCTImageFromLocalAssetURL (RCTUtils.m:864)>
Expected behavior
App not crashing randomly
Notes / preliminary analysis
The traces shows Mapbox running 82 threads of image loading.
Randomly, some thread crash, starting on this call:
RNMBXImageQueueOperation.start (RNMBXImageQueue.swift:72)
and crashing on this call
RCTImageFromLocalAssetURL (RCTUtils.m:864)
Those crashs are rare (2 per day on a production app with 5000 users) and is very possible it is a race condition.
Additional links and references
No response
Mapbox Implementation
Mapbox
Mapbox Version
11.8.0
React Native Version
0.76.0
Platform
iOS
@rnmapbox/mapsversion10.1.33
Standalone component to reproduce
Observed behavior and steps to reproduce
Expected behavior
App not crashing randomly
Notes / preliminary analysis
The traces shows Mapbox running 82 threads of image loading.
Randomly, some thread crash, starting on this call:
RNMBXImageQueueOperation.start (RNMBXImageQueue.swift:72)and crashing on this call
RCTImageFromLocalAssetURL (RCTUtils.m:864)Those crashs are rare (2 per day on a production app with 5000 users) and is very possible it is a race condition.
Additional links and references
No response