malcommac / SwiftLocation

⚓️ Async/Await CLLocationManager Wrapper for Apple Platforms
MIT License
3.4k stars 433 forks source link

[Bug]: Crash Tasks.SingleUpdateLocation.receivedLocationManagerEvent(_:) #386

Open ucerxxx opened 5 months ago

ucerxxx commented 5 months ago

Platform Version

iOS 15 -> 17

SDK Version

6.0 (latest)

Xcode Version

Xcode 15.3

Steps To Reproduce

Crash in prod, never experienced in Xcode. About 5% of users. Stack trace:

0 libswiftCore.dylib assertionFailure(:_:file:line:flags:) + 264 1 libswiftConcurrency.dylib CheckedContinuation.resume(returning:) + 508 2 MyProject SingleUpdateLocation.swift - Line 77 Tasks.SingleUpdateLocation.receivedLocationManagerEvent(:) + 77 3 MyProject LocationAsyncBridge.swift - Line 94 LocationAsyncBridge.dispatchEvent(:) + 94 4 MyProject LocationDelegate.swift - Line 53 @objc LocationDelegate.locationManager(:didUpdateLocations:) + 53 5 CoreLocation CLClientStartVehicleHeadingUpdates + 119784 6 CoreLocation CLClientStartVehicleHeadingUpdates + 114960

Expected Behavior

no crash

Actual Incorrect Behavior

Crashed: com.apple.main-thread

ucerxxx commented 5 months ago

investigated some more. looks like this is happening because in case of timeout continuation in not released. then it can be called second time on location update. this pr should fix an issue:

https://github.com/malcommac/SwiftLocation/pull/381

qizh commented 4 months ago

Got the same crash in my app

Teglgaard commented 3 weeks ago

Same here