Skip to content

firebase 11.9 crashes when app is running for over an hour in the background, 11.8.1 doesn't. #14541

Closed
@quantamrhino

Description

@quantamrhino

Description

I have app that runs in background and plays audio. on firebase 11.8.1, it runs for 8+ hrs without crash.
With 11.9, it crashes in the background in an hour and half. even with no foreground activity (screen off).
I tested this 3 times (debug build, release build and testflight build on real device running ios 18.3.1) with both versions of firebase, and got consistent results - 11.8.1 runs over 8 hours. 11.9 crashes in an hour and half roughly.
Nothing in my code has changed, only change was firebase version.
I also see no crashlytics crashes either (I know crashlytics crashes are being properly shown/processed - i have a test button with fatalError() to test that).

I guess if some background task is run longer than 30 seconds - app shall be terminated in the background?
i see warnings in debug logs on debug build - APMAnalyticsMeasurementBackgroundTask taking longer than 30 seconds

Reproducing the issue

App that has background audio permissions, plays audio in the background.
Run the app in the background. at some point it is terminated.

Firebase SDK Version

11.9.0

Xcode Version

16.1

Installation Method

Swift Package Manager

Firebase Product(s)

Crashlytics

Targeted Platforms

iOS

Relevant Log Output

11.9.0 - [FirebaseAnalytics][I-ACS023129] Network fetch failed. Will retry later. Code, error: 0, Error Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo={_kCFStreamErrorCodeKey=22, NSUnderlyingError=0x10bd9d650 {Error Domain=kCFErrorDomainCFNetwork Code=-1000 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, uses wifi, _kCFStreamErrorCodeKey=22, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <6D6B5620-CE74-459E-A03B-FEBB5561DCB2>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDownloadTask <6D6B5620-CE74-459E-A03B-FEBB5561DCB2>.<1>" ), NSLocalizedDescription=bad URL, NSErrorFailingURLStringKey=https://app-analytics-services.com/config/app/1:465338682942:ios:0792930e08ef40bed38b6f?platform=ios&runtime_version=0&gmp_version=110900, NSErrorFailingURLKey=https://app-analytics-services.com/config/app/1:465338682942:ios:0792930e08ef40bed38b6f?platform=ios&runtime_version=0&gmp_version=110900, _kCFStreamErrorDomainKey=1} 11.9.0 - [FirebaseAnalytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 1813.944071173668 Background Task 23 ("APMAnalyticsMeasurementBackgroundTask"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) foryour taskin a timely manner to avoid this. There are many of these... no crashlytics crashes after app is terminated in the background

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
{ "package": "abseil", "repositoryURL": "https://github.com/google/abseil-cpp-binary.git", "state": { "branch": null, "revision": "bbe8b69694d7873315fd3a4ad41efe043e1c07c5", "version": "1.2024072200.0" } }, { "package": "Firebase", "repositoryURL": "https://github.com/firebase/firebase-ios-sdk.git", "state": { "branch": null, "revision": "eb523407e4293568ed55590728205c359cbecc5b", "version": "11.9.0" } }, { "package": "GoogleAppMeasurement", "repositoryURL": "https://github.com/google/GoogleAppMeasurement.git", "state": { "branch": null, "revision": "d80e25104abe76d69a134d4ec18f011edd8df06c", "version": "11.9.0" } }, { "package": "GoogleDataTransport", "repositoryURL": "https://github.com/google/GoogleDataTransport.git", "state": { "branch": null, "revision": "617af071af9aa1d6a091d59a202910ac482128f9", "version": "10.1.0" } }, { "package": "GoogleUtilities", "repositoryURL": "https://github.com/google/GoogleUtilities.git", "state": { "branch": null, "revision": "53156c7ec267db846e6b64c9f4c4e31ba4cf75eb", "version": "8.0.2" } }, { "package": "gRPC", "repositoryURL": "https://github.com/google/grpc-binary.git", "state": { "branch": null, "revision": "cc0001a0cf963aa40501d9c2b181e7fc9fd8ec71", "version": "1.69.0" } }, { "package": "GTMSessionFetcher", "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", "state": { "branch": null, "revision": "a2ab612cb980066ee56d90d60d8462992c07f24b", "version": "3.5.0" } }, { "package": "InteropForGoogle", "repositoryURL": "https://github.com/google/interop-ios-for-google-sdks.git", "state": { "branch": null, "revision": "040d087ac2267d2ddd4cca36c757d1c6a05fdbfe", "version": "101.0.0" } }, { "package": "leveldb", "repositoryURL": "https://github.com/firebase/leveldb.git", "state": { "branch": null, "revision": "0706abcc6b0bd9cedfbb015ba840e4a780b5159b", "version": "1.22.2" } }, { "package": "nanopb", "repositoryURL": "https://github.com/firebase/nanopb.git", "state": { "branch": null, "revision": "b7e1104502eca3a213b46303391ca4d3bc8ddec1", "version": "2.30910.0" } } { "package": "Promises", "repositoryURL": "https://github.com/google/promises.git", "state": { "branch": null, "revision": "540318ecedd63d883069ae7f1ed811a2df00b6ac", "version": "2.4.0" } } 

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    close