react-native-background-geolocation
react-native-background-geolocation copied to clipboard
App Hanging -[TSLocationManager queue:type:]
Your Environment
- Plugin version: 4.16.2 (react-native-background-geolocation)
- Platform: iOS
- OS version: 15.8.2
- Device manufacturer / model: iPhone8,1
- React Native version: 0.73.6
- Plugin config:
{
enableHeadless: true,
disableLocationAuthorizationAlert: false,
locationAuthorizationRequest: 'Always',
backgroundPermissionRationale: {
title: "Allow *** to access to this device's location in the background?",
message: 'In order to track your activity in the background and to make sure you get job offers in your area, please enable "{backgroundPermissionOptionLabel}" location permission',
positiveAction: 'Change to {backgroundPermissionOptionLabel}',
negativeAction: 'Cancel',
},
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION,
distanceFilter: 10,
activityType: BackgroundGeolocation.ACTIVITY_TYPE_AUTOMOTIVE_NAVIGATION,
stopTimeout: 5,
debug: false,
logLevel: __DEV__ ? BackgroundGeolocation.LOG_LEVEL_INFO : BackgroundGeolocation.LOG_LEVEL_ERROR,
stopOnTerminate: true,
startOnBoot: false,
url: `${getApiBase()}/devices/telemetry/sync`,
method: 'POST',
batchSync: false,
autoSync: false,
preventSuspend: true,
heartbeatInterval: 60,
notification: {
title: 'Background tracking engaged',
text: '*** is tracking your current location to ensure you get job offers in your area',
},
}
Expected Behavior
The background geolocation should work consistently without hanging.
Actual Behavior
The app is hanging for at least 2000 ms when processing location updates.
Steps to Reproduce
- Initialize the GeolocationService
- Start location tracking
- Receive location updates
- Attempt to process and sync telemetry data to the server
Context
The app is using react-native-background-geolocation for tracking location in the background. The issue occurs when processing location updates and attempting to sync telemetry data. The app seems to be hanging in the queue:type: method of TSLocationManager.
Debug logs
Thread Stack Trace
Thread 0:
* Occurred in non-app
libsystem_kernel.dylib
__ulock_wait + 0x1688
(2 hidden frames)
* libsystem_platform.dylib
_os_unfair_lock_lock_slow + 0x1760
* libobjc.A.dylib
objc_sync_enter + 0x51b8
* *** (In App)
-[TSLocationManager queue:type:] + 0xa98e34
* *** (In App)
-[TSLocationManager onUpdateCurrentPosition:location:type:] + 0xa94da4
* *** (In App)
__49-[TSLocationManager createLocationChangedHandler]_block_invoke + 0xa94824
* *** (In App)
-[LocationManager locationManager:didUpdateLocations:] + 0xaad478
* Called from CoreLocation
CLClientStopVehicleHeadingUpdates + 0x2b548
(10 hidden frames)
* CoreLocation
CLCopyAppsUsingLocation + 0xde90
* CoreLocation
CLCopyTechnologiesInUse + 0xa0a4
* LocationSupport
<redacted> + 0x2384
* CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 0x6d688
* CoreFoundation
__CFRunLoopDoBlocks + 0x6e4ac
* CoreFoundation
__CFRunLoopRun + 0xb1d8
* CoreFoundation
CFRunLoopRunSpecific + 0x1e170
* GraphicsServices
GSEventRunModal + 0x1984
* UIKitCore
-[UIApplication _run] + 0x4e5a84
* UIKitCore
UIApplicationMain + 0x27ef74
* *** (In App)
main + 0x72f0
* Called from unknown
<redacted> at 0x103c1c4d0
Thread 23:
* Occurred in non-app
libsystem_kernel
+0x001688
__ulock_wait
(4 hidden frames)
* libdispatch
+0x004d5c
_dlock_wait
* libdispatch
+0x004b48
_dispatch_thread_event_wait_slow$VARIANT$mp
* libdispatch
+0x011bf8
__DISPATCH_WAIT_FOR_QUEUE__
* libdispatch
+0x01181c
_dispatch_sync_f_slow
* *** (In App)
+0xabfc44
-[TSQueue runOnMainQueueWithoutDeadlocking:]
* *** (In App)
+0xa98f60
-[TSLocationManager queue:type:]
* *** (In App)
+0xa908b8
-[TSLocationManager getCurrentPosition:]
* *** (In App)
+0x1a111c
-[RNBackgroundGeolocation getCurrentPosition:success:failure:]
* Called from CoreFoundation
+0x020cec
__invoking___
(2 hidden frames)
* CoreFoundation
+0x03cdd4
-[NSInvocation invoke]
* CoreFoundation
+0x071208
-[NSInvocation invokeWithTarget:]
* *** (In App)
+0x2752f4
-[RCTModuleMethod invokeWithBridge:module:arguments:]
* *** (In App)
+0x2773f8
facebook::react::invokeInner
* *** (In App)
+0x277048
facebook::react::RCTNativeModule::invoke
* Called from libdispatch
+0x063090
_dispatch_call_block_and_release
(5 hidden frames)
* libdispatch
+0x064090
_dispatch_client_callout
* libdispatch
+0x00a738
_dispatch_lane_serial_drain$VARIANT$mp
* libdispatch
+0x00b1f0
_dispatch_lane_invoke$VARIANT$mp
* libdispatch
+0x014ec4
_dispatch_workloop_worker_thread
* libsystem_pthread
+0x001dfc
_pthread_wqthread