Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in [APMSqliteStore endTransaction] #12962

Open
ilyavelilyaev opened this issue May 14, 2024 · 8 comments
Open

Crash in [APMSqliteStore endTransaction] #12962

ilyavelilyaev opened this issue May 14, 2024 · 8 comments
Assignees

Comments

@ilyavelilyaev
Copy link

ilyavelilyaev commented May 14, 2024

Description

App crashes shortly after launching for small number of users having different iOS versions, pretty randomly.

There was a similar issue closed due to missing attention from reporter #11105 (comment)

Reproducing the issue

Could not reproduce locally

Firebase SDK Version

10.24

Xcode Version

15.2

Installation Method

CocoaPods

Firebase Product(s)

Crashlytics, Remote Config

Targeted Platforms

iOS

Relevant Log Output

com.google.fira.worker
0  libsystem_kernel.dylib         0xf34c fsync + 8
1  libsqlite3.dylib               0x4cab4 sqlite3_free_table + 47104
2  libsqlite3.dylib               0x55b68 sqlite3_randomness + 1664
3  libsqlite3.dylib               0x4c674 sqlite3_free_table + 46016
4  libsqlite3.dylib               0x3cd7c sqlite3_value_text + 19848
5  libsqlite3.dylib               0x3c944 sqlite3_value_text + 18768
6  libsqlite3.dylib               0x15c74 sqlite3_finalize + 1812
7  libsqlite3.dylib               0x36d04 sqlite3_step + 46152
8  libsqlite3.dylib               0x2bc80 sqlite3_step + 964
9  libsqlite3.dylib               0x8908 sqlite3_exec + 368
10 App                        0x372d218 -[APMSqliteStore endTransaction] + 4362064408
11 App                        0x372d0bc -[APMSqliteStore performTransactionWithError:block:] + 4362064060
12 App                        0x36a4e24 -[APMDatabase performTransaction:] + 4361506340
13 App                        0x36dd2a0 -[APMMeasurement(Event) writeFilteredEventOnWorkerQueue:] + 4361736864
14 App                        0x36dcfb4 -[APMMeasurement(Event) writeEventOnWorkerQueue:] + 4361736116
15 App                        0x36dca50 -[APMMeasurement(Event) handleEventOnWorkerQueue:] + 4361734736
16 App                        0x36d151c -[APMMeasurement logEventOnWorkerQueue:notifyEventListeners:] + 4361688348
17 App                        0x36d1494 -[APMMeasurement logEventOnWorkerQueueWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:] + 4361688212
18 App                        0x36d1228 __151-[APMMeasurement logEventWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:]_block_invoke + 4361687592
19 App                        0x3724220 __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 4362027552
20 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
21 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
22 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
23 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
24 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
25 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
26 libsystem_pthread.dylib        0x1f20 _pthread_wqthread + 288
27 libsystem_pthread.dylib        0x1fc0 start_wqthread + 8

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

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@htcgh
Copy link
Member

htcgh commented May 15, 2024

@ilyavelilyaev Thanks for the report. By any chance, does your project or any of your dependencies call sqlite3_shutdown()? This issue seems similar to past sqlite issues (#4278, #6039) due to sqlite3_shutdown() being called outside of Analytics.

@ilyavelilyaev
Copy link
Author

@htcgh Thanks for reply!
I've checked our codebase and it looks like only Firebase has a dependency on sqlite3 and there are no calls to sqlite3_shutdown()

@htcgh
Copy link
Member

htcgh commented May 16, 2024

Are there any other stack traces in the crash report that also use sqlite3?

@ilyavelilyaev
Copy link
Author

@htcgh No, only com.google.fira.worker thread has calls to sqlite3, others don't

@htcgh
Copy link
Member

htcgh commented May 17, 2024

@ilyavelilyaev If you can share any crash reports in their entirety or provide any other information like affected iOS versions, that would really be appreciated. My team will continue to look into this, but progress will be really slow until we can reproduce the crash.

@ilyavelilyaev
Copy link
Author

@htcgh thanks for looking into this. Attaching couple of full stack traces.
endTransaction_stacktrace_3.txt
endTransaction_stacktrace_2.txt
endTransaction_stacktrace_1.txt

As for iOS versions - all versions are affected iOS 13 - iOS 17
Devices - it seems crash happens more often on older devices such as iPhone 11, iPhone XR, and very rarely on newer devices

@Jeanno
Copy link

Jeanno commented Jun 27, 2024

I am also having a similar issue with a small number of my users. Here's the stack trace

          com.google.fira.worker
0  libsystem_kernel.dylib         0x7830 guarded_pwrite_np + 8
1  libsqlite3.dylib               0x93148 sqlite3_sourceid + 8344
2  libsqlite3.dylib               0x4c8f4 sqlite3_free_table + 46676
3  libsqlite3.dylib               0x55d40 sqlite3_randomness + 2156
4  libsqlite3.dylib               0x4c67c sqlite3_free_table + 46044
5  libsqlite3.dylib               0x3cd68 sqlite3_value_text + 19848
6  libsqlite3.dylib               0x3c930 sqlite3_value_text + 18768
7  libsqlite3.dylib               0x15c60 sqlite3_finalize + 1812
8  libsqlite3.dylib               0x36cf0 sqlite3_step + 46152
9  libsqlite3.dylib               0x2bc6c sqlite3_step + 964
10 libsqlite3.dylib               0x88cc sqlite3_exec + 368
11 SignSticker                    0x1a6fc74 -[APMSqliteStore endTransaction] + 2272868
12 SignSticker                    0x1a6fb18 -[APMSqliteStore performTransactionWithError:block:] + 2272520
13 SignSticker                    0x19e77cc -[APMDatabase performTransaction:] + 1714620
14 SignSticker                    0x1a1bf14 -[APMMeasurement(Bundle) bundleRawEvents] + 1929476
15 SignSticker                    0x1a1271c -[APMMeasurement uploadData] + 1890572
16 SignSticker                    0x1a1a6f4 __49-[APMMeasurement handleAppWillResignActiveEvent:]_block_invoke_3 + 1923300
17 SignSticker                    0x1a66bf0 __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 2235872
18 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
19 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
20 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
21 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
22 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
23 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
24 libsystem_pthread.dylib        0x4934 _pthread_wqthread + 288
25 libsystem_pthread.dylib        0x10cc start_wqthread + 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants