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

iOS app sometimes crashes in background #1057

Closed
cyBerta opened this issue Feb 15, 2021 · 7 comments · Fixed by #1068
Closed

iOS app sometimes crashes in background #1057

cyBerta opened this issue Feb 15, 2021 · 7 comments · Fixed by #1068
Assignees
Labels

Comments

@cyBerta
Copy link
Contributor

cyBerta commented Feb 15, 2021

The crash happens in the core as we can see in the crash log.

Nevertheless ChatViewController.startTimer() should be stopped when the app is in background / the display is turned off because the closure in startTimer() is responsible for updating the UI. That's not needed at all in this situation.

Hardware Model:      iPhone13,3
Process:             deltachat-ios [5128]
Path:              
Identifier:          chat.delta
Version:             49 (1.16.0)
AppStoreTools:       12D4d
AppVariant:          1:iPhone13,3:14
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                unknown
Parent Process:      launchd [1]
Coalition:           chat.delta [1283]


Date/Time:           2021-02-13 14:42:13.5452 +0100
Launch Time:         2021-02-13 10:38:01.0939 +0100
OS Version:          iPhone OS 14.4 (18D52)
Release Type:        User
Baseband Version:    1.42.03
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: Namespace RUNNINGBOARD, Code 0xdead10cc
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001be6b4ac8 pread + 8
1   DcCore                        	0x00000001013e4a20 0x100af4000 + 9374240
2   DcCore                        	0x00000001013f275c 0x100af4000 + 9430876
3   DcCore                        	0x00000001013f2460 0x100af4000 + 9430112
4   DcCore                        	0x0000000101416e0c 0x100af4000 + 9580044
5   DcCore                        	0x0000000101411d4c 0x100af4000 + 9559372
6   DcCore                        	0x0000000101418bc8 0x100af4000 + 9587656
7   DcCore                        	0x00000001014035d4 0x100af4000 + 9500116
8   DcCore                        	0x00000001013cf848 0x100af4000 + 9287752
9   DcCore                        	0x0000000101343cb8 0x100af4000 + 8715448
10  DcCore                        	0x00000001010302e0 0x100af4000 + 5489376
11  DcCore                        	0x0000000100bdb374 0x100af4000 + 947060
12  DcCore                        	0x0000000100b8026c 0x100af4000 + 574060
13  DcCore                        	0x0000000100f17840 0x100af4000 + 4339776
14  DcCore                        	0x0000000101095c44 0x100af4000 + 5905476
15  DcCore                        	0x0000000100b008c8 DcContext.getChatMessages(chatId:) + 52 (Wrapper.swift:253)
16  DcCore                        	0x0000000100b008c8 DcContext.getMessageIds(chatId:count:from:) + 72 (Wrapper.swift:31)
17  deltachat-ios                 	0x0000000100477f10 ChatViewController.getMessageIds() + 64 (ChatViewController.swift:746)
18  deltachat-ios                 	0x0000000100477f10 closure #1 in closure #1 in ChatViewController.startTimer() + 124 (ChatViewController.swift:294)
19  deltachat-ios                 	0x0000000100517318 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:0)
20  libdispatch.dylib             	0x000000019035024c _dispatch_call_block_and_release + 32 (init.c:1454)
21  libdispatch.dylib             	0x0000000190351db0 _dispatch_client_callout + 20 (object.m:559)
22  libdispatch.dylib             	0x000000019035f7ac _dispatch_main_queue_callback_4CF + 836 (inline_internal.h:2548)
23  CoreFoundation                	0x00000001906d911c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1790)
24  CoreFoundation                	0x00000001906d3120 __CFRunLoopRun + 2508 (CFRunLoop.c:3118)
25  CoreFoundation                	0x00000001906d221c CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
26  GraphicsServices              	0x00000001a829e784 GSEventRunModal + 164 (GSEvent.c:2259)
27  UIKitCore                     	0x0000000193112ee8 -[UIApplication _run] + 1072 (UIApplication.m:3253)
28  UIKitCore                     	0x000000019311875c UIApplicationMain + 168 (UIApplication.m:4707)
29  deltachat-ios                 	0x000000010046494c main + 68 (AppDelegate.swift:12)
30  libdyld.dylib                 	0x00000001903926b0 start + 4

@cyBerta cyBerta added the bug label Feb 15, 2021
@cyBerta
Copy link
Contributor Author

cyBerta commented Feb 15, 2021

@dignifiedquire did I recall correctly this bug happens if the app is in background?

@cyBerta
Copy link
Contributor Author

cyBerta commented Feb 15, 2021

Reminder to myself: check if it's possible to upload symbols with each iOS app release so that crash logs in the core are easier to read

@dignifiedquire
Copy link
Member

yes this happens usually when the app is in the background

@cyBerta
Copy link
Contributor Author

cyBerta commented Mar 1, 2021

DcContext.getChatMessages(chatId:) calls dc_get_chat_msgs

@link2xt
Copy link
Contributor

link2xt commented Mar 1, 2021

Since it's a SIGKILL, it's not even a panic/unwrap, which normally results in SIGABRT.

Here is a similar issue I found:
https://github.com/Adobe-Marketing-Cloud/mobile-services/issues/352

@jum
Copy link

jum commented Mar 1, 2021

It may be that you simply use too much undeclared time in your background processing. If you wrap your background processing with UIApplictaion.beginBackgroundTask/EndBackgroundTask you get more time allocated before iOS starts KILLing you.

@cyBerta
Copy link
Contributor Author

cyBerta commented Mar 1, 2021

If you wrap your background processing with UIApplictaion.beginBackgroundTask/EndBackgroundTask

We're already doing that. Anyways, I hope this will be fixed by stopping the timer if the UI is not visible anymore.

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

Successfully merging a pull request may close this issue.

4 participants