Skip to content

[firebase_remote_config]: -[APMMeasurement fetchRemoteConfig] EXC_BAD_ACCESS (KERN_INVALID_ADDRESS) on IOS #17913

@Tom3652

Description

@Tom3652

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Remote Config

Which platforms are affected?

iOS

Description

The crash :

          Crashed: com.google.fira.worker
0  libobjc.A.dylib                0x603c objc_loadWeakRetained + 204
1  libobjc.A.dylib                0x9528 objc_loadWeak + 24
2  Foundation                     0x2ed8 <redacted> + 32
3  Foundation                     0x95ae74 <redacted> + 196
4  Foundation                     0x2124c <redacted> + 96
5  Foundation                     0x70f4 <redacted> + 108
6  Foundation                     0x95a8a0 <redacted> + 172
7  GoogleUtilities                0xd46c +[GULNetworkURLSession setSessionInFetcherMap:forSessionID:] + 689 (GULNetworkURLSession.m:689)
8  GoogleUtilities                0xbaf4 -[GULNetworkURLSession sessionIDFromAsyncGETRequest:completionHandler:] + 224 (GULNetworkURLSession.m:224)
9  GoogleUtilities                0xa2b0 -[GULNetwork getURL:headers:queue:usingBackgroundSession:completionHandler:] + 222 (GULNetwork.m:222)
10 Runner                         0xf3a10 -[APMMeasurement fetchRemoteConfig]
11 Runner                         0xedd54 -[APMMeasurement uploadData]
12 Runner                         0xed548 __32-[APMMeasurement updateSchedule]_block_invoke_2
13 Runner                         0x14a820 __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke
14 libdispatch.dylib              0x1adc _dispatch_call_block_and_release + 32
15 libdispatch.dylib              0x1b7ec _dispatch_client_callout + 16
16 libdispatch.dylib              0xa468 _dispatch_lane_serial_drain + 740
17 libdispatch.dylib              0xaf44 _dispatch_lane_invoke + 388
18 libdispatch.dylib              0x153ec _dispatch_root_queue_drain_deferred_wlh + 292
19 libdispatch.dylib              0x14ce4 _dispatch_workloop_worker_thread + 692
20 libsystem_pthread.dylib        0x13b8 _pthread_wqthread + 292
21 libsystem_pthread.dylib        0x8c0 start_wqthread + 8

From Gemini in Crashlytics :

The application is crashing with an EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000 exception on a background thread named com.google.fira.worker . The crash occurs within the - [APMMeasurement fetchRemoteConfig] method, indicating an attempt to access an invalid memory address during a remote configuration fetch operation. This type of crash, a null pointer dereference, is very common in applications and can occur due to various reasons, often related to object lifecycle management or improper handling of optional values.

Potential Causes:
Deallocated Object Access: The most probable cause for an EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000 crash, particularly with a null address, is attempting to access an object that has already been deallocated. In the context of - [APMMeasurement fetchRemoteConfig] , it's possible that an instance of APMMeasurement or one of its dependencies has been released from memory while the background thread was still attempting to interact with it. This is especially pertinent when operations are performed asynchronously or in the background.
Uninitialized Pointer/Variable: A pointer or variable used within fetchRemoteConfig might not have been properly initialized, leading to a default null value. Subsequent dereferencing of this null pointer would result in a crash.
Concurrency Issues: Since the crash occurs on a background thread ( com.google.fira.worker ) while the app is in the background, race conditions are a strong possibility. The main thread or another background thread might have deallocated an object or invalidated a resource that fetchRemoteConfig was trying to use, without proper synchronization or locking mechanisms in place.
SDK/Library Interaction: Given the symbol com.google.fira.worker and APMMeasurement , this likely involves interaction with a Google-related SDK (possibly Firebase Analytics or Crashlytics). There might be an issue in how the application is integrating or interacting with this SDK, or a specific version of the SDK might have a bug.
Background Task Lifecycle: When an application moves to the background, its execution time and resource access are constrained. If fetchRemoteConfig is a long-running or resource-intensive operation, the system might terminate background tasks or release resources unexpectedly, leading to instability if the operation doesn't gracefully handle these state changes.

Reproducing the issue

No idea unfortunately...
I can provide the full stack trace here :
trace.txt

Firebase Core version

4.2.1

Flutter Version

3.38.5

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions