firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

GDTStorage background task running for more than 30s, causing app to be terminated by the system

Open mluisbrown opened this issue 4 months ago • 7 comments

Description

When running our app with SDK 11.15.0 we are seeing repeated instances of this message in the Xcode console log:

Background Task 4,617 ("GDTStorage"), was created over 30 seconds ago. 
In applications running in the background, this creates a risk of termination. 
Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.

This causes our app to frequently be terminated by the system, which appears to the user like a crash.

We are only using FirebaseCrashlytics, FirebasePerformance and FirebaseDynamicLinks. The only SDK calls we make are FirebaseApp.configure() and the following Crashlytics calls:

Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(true)
Crashlytics.crashlytics().setCustomValue(_:, forKey:)
Crashlytics.crashlytics().setUserID(_:)

This background task seems to be being created here: https://github.com/google/GoogleDataTransport/blob/398227941b1b83179d3241f72842e2b1e23663f4/GoogleDataTransport/GDTCORLibrary/GDTCORFlatFileStorage.m#L130

There is an issue in that repo related to this, which has so far been ignored.

Reproducing the issue

We just run the app and it happens after about 30 seconds, whilst the app is still running. When the app is put into background, the messages continue.

Firebase SDK Version

11.15.0 and 12.0.0

Xcode Version

16.4

Installation Method

Swift Package Manager

Firebase Product(s)

Crashlytics, Performance, DynamicLinks

Targeted Platforms

iOS

Relevant Log Output


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

I've only added the firebase and google repos, not the entire Package.resolved

Expand Package.resolved snippet

    {
      "identity" : "firebase-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/firebase-ios-sdk.git",
      "state" : {
        "revision" : "fdc352fabaf5916e7faa1f96ad02b1957e93e5a5",
        "version" : "11.15.0"
      }
    },
    {
      "identity" : "leveldb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/leveldb.git",
      "state" : {
        "revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
        "version" : "1.22.5"
      }
    },
    {
      "identity" : "nanopb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/nanopb.git",
      "state" : {
        "revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
        "version" : "2.30910.0"
      }
    },
    {
      "identity" : "google-ads-on-device-conversion-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/googleads/google-ads-on-device-conversion-ios-sdk",
      "state" : {
        "revision" : "428d8bb138e00f9a3f4f61cc6cd8863607524f65",
        "version" : "2.1.0"
      }
    },
    {
      "identity" : "googleappmeasurement",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleAppMeasurement.git",
      "state" : {
        "revision" : "45ce435e9406d3c674dd249a042b932bee006f60",
        "version" : "11.15.0"
      }
    },
    {
      "identity" : "googledatatransport",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleDataTransport.git",
      "state" : {
        "revision" : "617af071af9aa1d6a091d59a202910ac482128f9",
        "version" : "10.1.0"
      }
    },
    {
      "identity" : "googleutilities",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleUtilities.git",
      "state" : {
        "revision" : "60da361632d0de02786f709bdc0c4df340f7613e",
        "version" : "8.1.0"
      }
    },
    {
      "identity" : "grpc-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/grpc-binary.git",
      "state" : {
        "revision" : "cc0001a0cf963aa40501d9c2b181e7fc9fd8ec71",
        "version" : "1.69.0"
      }
    },
    {
      "identity" : "gtm-session-fetcher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/gtm-session-fetcher.git",
      "state" : {
        "revision" : "3cdb78efb79b4a5383c3911488d8025bfc545b5e",
        "version" : "4.3.0"
      }
    },
    {
      "identity" : "interop-ios-for-google-sdks",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/interop-ios-for-google-sdks.git",
      "state" : {
        "revision" : "040d087ac2267d2ddd4cca36c757d1c6a05fdbfe",
        "version" : "101.0.0"
      }
    },

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

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

mluisbrown avatar Jul 18 '25 09:07 mluisbrown