synonymdev / bitkit

Self-custodial Bitcoin and Lightning Wallet for Android and iOS.
https://bitkit.to
MIT License
113 stars 23 forks source link

[Bug]: Crash when bringing app back to foreground #1925

Closed mattcrv closed 1 month ago

mattcrv commented 3 months ago

Describe the bug

The app sometimes crashes when bringing it back to the foreground after backgrounding it for a minute or two.

It happened 3 times on June 2, and many times on May 31. Crash reports sent via Testflight. The most recent Testflight crash log is is pasted below. Note that not all May 31 crash reports are related to this issue, some are due to #1922.

In one of the cases (not the one screen recorded below), the "Electrum Connection Failed. Bitkit could not establish a connection to Electrum." toast appeared before the app crashed.

Reproduce

  1. Try backgrounding the app while certain screens are opened (send, receive, lightning connection, etc.), and bring it back to the foreground a minute or two later

Screenshots / Recording

https://github.com/synonymdev/bitkit/assets/93796166/050247ca-fd6c-4626-927c-67663087bcde

Operating system

iOS 17.5.1

Bitkit version

49d1359

Log output

Incident Identifier: E00EA710-B619-4E3B-89BF-BE6ABD173F18
Distributor ID:      com.apple.TestFlight
Hardware Model:      iPhone16,1
Process:             bitkit [12266]
Path:                /private/var/containers/Bundle/Application/55ED816A-A352-44D3-B32D-ABD4359ACB1C/bitkit.app/bitkit
Identifier:          to.bitkit
Version:             1.0 (120)
AppStoreTools:       15F31e
AppVariant:          1:iPhone16,1:17.4
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           to.bitkit [2930]

Date/Time:           2024-06-02 13:12:30.9973 -0300
Launch Time:         2024-06-02 12:57:51.5900 -0300
OS Version:          iPhone OS 17.5.1 (21F90)
Release Type:        User
Baseband Version:    1.60.02
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000330
Exception Codes: 0x0000000000000001, 0x0000000000000330
VM Region Info: 0x330 is not in any region.  Bytes before following region: 4362878160
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                   1040c4000-1040c8000 [   16K] r-x/r-x SM=COW  /var/containers/Bundle/Application/55ED816A-A352-44D3-B32D-ABD4359ACB1C/bitkit.app/bitkit
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [12266]

Triggered by Thread:  13

Thread 0 name:
Thread 0:
0   libsystem_kernel.dylib          0x00000001ee120808 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001ee124008 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001ee123f20 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001ee123d60 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001a5040f5c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001a5040600 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001a503fcd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   GraphicsServices                0x00000001e9ef01a8 GSEventRunModal + 164 (GSEvent.c:2196)
8   UIKitCore                       0x00000001a767890c -[UIApplication _run] + 888 (UIApplication.m:3713)
9   UIKitCore                       0x00000001a772c9d0 UIApplicationMain + 340 (UIApplication.m:5303)
10  bitkit                          0x00000001040c82f4 main + 80 (main.m:8)
11  dyld                            0x00000001c86f1e4c start + 2240 (dyldMain.cpp:1298)

Thread 1:
0   libsystem_pthread.dylib         0x0000000201ec40c4 start_wqthread + 0 (:-1)

Thread 2 name:
Thread 2:
0   libsystem_kernel.dylib          0x00000001ee120808 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001ee124008 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001ee123f20 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001ee123d60 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001a5040f5c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001a5040600 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001a503fcd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   Foundation                      0x00000001a3f60e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                      0x00000001a3f60c9c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
9   UIKitCore                       0x00000001a768c640 -[UIEventFetcher threadMain] + 420 (UIEventFetcher.m:1207)
10  Foundation                      0x00000001a3f77718 __NSThread__start__ + 732 (NSThread.m:991)
11  libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
12  libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 3 name:
Thread 3:
0   libsystem_kernel.dylib          0x00000001ee120808 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001ee124008 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001ee123f20 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001ee123d60 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001a5040f5c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001a5040600 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001a503fcd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   bitkit                          0x00000001041e34a0 +[RCTCxxBridge runRunLoop] + 212 (RCTCxxBridge.mm:332)
8   Foundation                      0x00000001a3f77718 __NSThread__start__ + 732 (NSThread.m:991)
9   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
10  libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 4 name:
Thread 4:
0   libsystem_kernel.dylib          0x00000001ee1261cc __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x0000000201ec66e4 _pthread_cond_wait + 1228 (pthread_cond.c:862)
2   libc++.1.dylib                  0x00000001b5426504 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:45)
3   hermes                          0x0000000106e38d04 hermes::vm::HadesGC::Executor::worker() + 316 (:-1)
4   hermes                          0x0000000106e38ba4 void* std::__1::__thread_proxy[abi:v15006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, hermes::vm::HadesGC::Executor::Execu... + 44 (:-1)
5   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
6   libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 5:
0   libsystem_kernel.dylib          0x00000001ee1261cc __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x0000000201ec66e4 _pthread_cond_wait + 1228 (pthread_cond.c:862)
2   libc++.1.dylib                  0x00000001b5426504 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:45)
3   bitkit                          0x000000010469dd98 void std::__1::condition_variable::wait<margelo::DispatchQueue::dispatch_queue::dispatch_thread_handler()::$_0>(std::__1::unique_lock<std::__1::mutex>&, margelo::DispatchQueue::dispatch_queue::disp... + 28 (condition_variable.h:148)
4   bitkit                          0x000000010469dd98 margelo::DispatchQueue::dispatch_queue::dispatch_thread_handler() + 96 (MGLDispatchQueue.cpp:58)
5   bitkit                          0x000000010469e32c decltype(*std::declval<margelo::DispatchQueue::dispatch_queue*>().*std::declval<void (margelo::DispatchQueue::dispatch_queue::*)()>()()) std::__1::__invoke[abi:ue170006]<void (margelo::DispatchQueu... + 28 (invoke.h:308)
6   bitkit                          0x000000010469e32c void std::__1::__thread_execute[abi:ue170006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (margelo::DispatchQueue::dispatch_queue::*)(... + 28 (thread.h:227)
7   bitkit                          0x000000010469e32c void* std::__1::__thread_proxy[abi:ue170006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (margelo::DispatchQueue::disp... + 72 (thread.h:238)
8   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
9   libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 6 name:
Thread 6:
0   libsystem_kernel.dylib          0x00000001ee1261cc __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x0000000201ec66e4 _pthread_cond_wait + 1228 (pthread_cond.c:862)
2   libc++.1.dylib                  0x00000001b5426504 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:45)
3   hermes                          0x0000000106e38d04 hermes::vm::HadesGC::Executor::worker() + 316 (:-1)
4   hermes                          0x0000000106e38ba4 void* std::__1::__thread_proxy[abi:v15006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, hermes::vm::HadesGC::Executor::Execu... + 44 (:-1)
5   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
6   libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 7:
0   libsystem_kernel.dylib          0x00000001ee1261cc __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x0000000201ec66e4 _pthread_cond_wait + 1228 (pthread_cond.c:862)
2   libc++.1.dylib                  0x00000001b5426504 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:45)
3   bitkit                          0x00000001046ce264 void std::__1::condition_variable::wait<RNSkia::RNSkDispatchQueue::dispatch_thread_handler()::$_0>(std::__1::unique_lock<std::__1::mutex>&, RNSkia::RNSkDispatchQueue::dispatch_thread_handler()::$_0) + 28 (condition_variable.h:148)
4   bitkit                          0x00000001046ce264 RNSkia::RNSkDispatchQueue::dispatch_thread_handler() + 96 (RNSkDispatchQueue.cpp:57)
5   bitkit                          0x00000001046ce4a8 decltype(*std::declval<RNSkia::RNSkDispatchQueue*>().*std::declval<void (RNSkia::RNSkDispatchQueue::*)()>()()) std::__1::__invoke[abi:ue170006]<void (RNSkia::RNSkDispatchQueue::*)(), RNSkia::RNSkDi... + 28 (invoke.h:308)
6   bitkit                          0x00000001046ce4a8 void std::__1::__thread_execute[abi:ue170006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (RNSkia::RNSkDispatchQueue::*)(), RNSkia::RN... + 28 (thread.h:227)
7   bitkit                          0x00000001046ce4a8 void* std::__1::__thread_proxy[abi:ue170006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (RNSkia::RNSkDispatchQueue::*... + 72 (thread.h:238)
8   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
9   libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 8 name:
Thread 8:
0   libsystem_kernel.dylib          0x00000001ee120808 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001ee124008 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001ee123f20 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001ee123d60 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001a5040f5c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001a5040600 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001a503fcd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   Foundation                      0x00000001a3f60e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   bitkit                          0x00000001040d5330 +[GCDAsyncSocket cfstreamThread:] + 276 (GCDAsyncSocket.m:7686)
9   Foundation                      0x00000001a3f77718 __NSThread__start__ + 732 (NSThread.m:991)
10  libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
11  libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 9 name:
Thread 9:
0   libsystem_kernel.dylib          0x00000001ee120808 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001ee124008 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001ee123f20 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001ee123d60 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001a5040f5c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001a5040600 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001a503fcd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   CFNetwork                       0x00000001a6220c90 +[__CFN_CoreSchedulingSetRunnable _run:] + 384 (CoreSchedulingSet.mm:1473)
8   Foundation                      0x00000001a3f77718 __NSThread__start__ + 732 (NSThread.m:991)
9   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
10  libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 10 name:
Thread 10:
0   libsystem_kernel.dylib          0x00000001ee128474 __select + 8 (:-1)
1   CoreFoundation                  0x00000001a50abb7c __CFSocketManager + 640 (CFSocket.c:1340)
2   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
3   libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 11 name:
Thread 11:
0   libsystem_kernel.dylib          0x00000001ee120784 semaphore_wait_trap + 8 (:-1)
1   libdispatch.dylib               0x00000001acf16370 _dispatch_sema4_wait + 28 (lock.c:139)
2   libdispatch.dylib               0x00000001acf16a20 _dispatch_semaphore_wait_slow + 132 (semaphore.c:132)
3   bitkit                          0x000000010464e518 static BackupClient.persist(_:_:) + 2624 (BackupClient.swift:322)
4   bitkit                          0x00000001046587e0 specialized static BackupClient.persist(_:_:retry:onTryFail:) + 456 (BackupClient.swift:243)
5   bitkit                          0x00000001046542ec specialized static BackupClient.persist(_:_:retry:onTryFail:) + 56 (<compiler-generated>:0)
6   bitkit                          0x00000001046542ec closure #1 in static BackupClient.addToPersistQueue(_:_:callback:) + 240 (BackupClient.swift:698)
7   bitkit                          0x00000001043c921c thunk for @escaping @callee_guaranteed () -> () + 28
8   libdispatch.dylib               0x00000001acf1413c _dispatch_call_block_and_release + 32 (init.c:1530)
9   libdispatch.dylib               0x00000001acf15dd4 _dispatch_client_callout + 20 (object.m:576)
10  libdispatch.dylib               0x00000001acf1d400 _dispatch_lane_serial_drain + 748 (queue.c:3900)
11  libdispatch.dylib               0x00000001acf1df30 _dispatch_lane_invoke + 380 (queue.c:3991)
12  libdispatch.dylib               0x00000001acf28cb4 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6998)
13  libdispatch.dylib               0x00000001acf28528 _dispatch_workloop_worker_thread + 404 (queue.c:6592)
14  libsystem_pthread.dylib         0x0000000201ec7934 _pthread_wqthread + 288 (pthread.c:2696)
15  libsystem_pthread.dylib         0x0000000201ec40cc start_wqthread + 8 (:-1)

Thread 12 name:
Thread 12:
0   libsystem_kernel.dylib          0x00000001ee120784 semaphore_wait_trap + 8 (:-1)
1   libdispatch.dylib               0x00000001acf16370 _dispatch_sema4_wait + 28 (lock.c:139)
2   libdispatch.dylib               0x00000001acf16a20 _dispatch_semaphore_wait_slow + 132 (semaphore.c:132)
3   bitkit                          0x000000010464e518 static BackupClient.persist(_:_:) + 2624 (BackupClient.swift:322)
4   bitkit                          0x00000001046587e0 specialized static BackupClient.persist(_:_:retry:onTryFail:) + 456 (BackupClient.swift:243)
5   bitkit                          0x00000001046542ec specialized static BackupClient.persist(_:_:retry:onTryFail:) + 56 (<compiler-generated>:0)
6   bitkit                          0x00000001046542ec closure #1 in static BackupClient.addToPersistQueue(_:_:callback:) + 240 (BackupClient.swift:698)
7   bitkit                          0x00000001043c921c thunk for @escaping @callee_guaranteed () -> () + 28
8   libdispatch.dylib               0x00000001acf1413c _dispatch_call_block_and_release + 32 (init.c:1530)
9   libdispatch.dylib               0x00000001acf15dd4 _dispatch_client_callout + 20 (object.m:576)
10  libdispatch.dylib               0x00000001acf1d400 _dispatch_lane_serial_drain + 748 (queue.c:3900)
11  libdispatch.dylib               0x00000001acf1df30 _dispatch_lane_invoke + 380 (queue.c:3991)
12  libdispatch.dylib               0x00000001acf28cb4 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6998)
13  libdispatch.dylib               0x00000001acf28528 _dispatch_workloop_worker_thread + 404 (queue.c:6592)
14  libsystem_pthread.dylib         0x0000000201ec7934 _pthread_wqthread + 288 (pthread.c:2696)
15  libsystem_pthread.dylib         0x0000000201ec40cc start_wqthread + 8 (:-1)

Thread 13 name:
Thread 13 Crashed:
0   LightningDevKit                 0x00000001062bbcfc lightning::ln::peer_handler::PeerManager$LT$Descriptor$C$CM$C$RM$C$OM$C$L$C$CMH$C$NS$GT$::get_ephemeral_key::hb18c0406274574bf + 24
1   LightningDevKit                 0x00000001062bf264 lightning::ln::peer_handler::PeerManager$LT$Descriptor$C$CM$C$RM$C$OM$C$L$C$CMH$C$NS$GT$::new_outbound_connection::hb8e6a2b3e5329847 + 84
2   LightningDevKit                 0x00000001061d22a0 PeerManager_new_outbound_connection + 840
3   LightningDevKit                 0x0000000105be1dc8 socket_connect + 400 (ldk_net.c:406)
4   LightningDevKit                 0x0000000105edf700 closure #1 in closure #1 in TCPPeerHandler.connect(address:port:theirNodeId:) + 24 (ChannelManagerConstructor.swift:480)
5   LightningDevKit                 0x0000000105edf700 thunk for @callee_guaranteed (@unowned UnsafePointer<sockaddr>) -> (@unowned Int32, @error @owned Error) + 24 (<compiler-generated>:0)
6   LightningDevKit                 0x0000000105edf700 specialized UnsafePointer.withMemoryRebound<A, B>(to:capacity:_:) + 24 (<compiler-generated>:0)
7   LightningDevKit                 0x0000000105edf700 closure #1 in TCPPeerHandler.connect(address:port:theirNodeId:) + 24 (ChannelManagerConstructor.swift:478)
8   LightningDevKit                 0x0000000105edf700 thunk for @callee_guaranteed (@unowned UnsafePointer<sockaddr_in>) -> (@unowned Int32, @error @owned Error) + 24 (<compiler-generated>:0)
9   LightningDevKit                 0x0000000105edf700 specialized withUnsafePointer<A, B>(to:_:) + 24 (<compiler-generated>:0)
10  LightningDevKit                 0x0000000105edf700 TCPPeerHandler.connect(address:port:theirNodeId:) + 644 (ChannelManagerConstructor.swift:476)
11  bitkit                          0x0000000104677714 specialized Ldk.addPeer(_:port:pubKey:timeout:resolve:reject:) + 164 (Ldk.swift:629)
12  bitkit                          0x000000010466b9f4 Ldk.addPeer(_:port:pubKey:timeout:resolve:reject:) + 40 (<compiler-generated>:0)
13  bitkit                          0x000000010466b9f4 @objc Ldk.addPeer(_:port:pubKey:timeout:resolve:reject:) + 200
14  CoreFoundation                  0x00000001a500d814 __invoking___ + 148 (:-1)
15  CoreFoundation                  0x00000001a500c860 -[NSInvocation invoke] + 428 (NSForwarding.m:3411)
16  CoreFoundation                  0x00000001a50831dc -[NSInvocation invokeWithTarget:] + 64 (NSForwarding.m:3508)
17  bitkit                          0x0000000104200cd8 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 388 (RCTModuleMethod.mm:584)
18  bitkit                          0x0000000104202de0 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 456 (RCTNativeModule.mm:196)
19  bitkit                          0x0000000104202a30 facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const + 68 (RCTNativeModule.mm:113)
20  bitkit                          0x0000000104202a30 invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 112 (RCTNativeModule.mm:104)
21  libdispatch.dylib               0x00000001acf1413c _dispatch_call_block_and_release + 32 (init.c:1530)
22  libdispatch.dylib               0x00000001acf15dd4 _dispatch_client_callout + 20 (object.m:576)
23  libdispatch.dylib               0x00000001acf1d400 _dispatch_lane_serial_drain + 748 (queue.c:3900)
24  libdispatch.dylib               0x00000001acf1df30 _dispatch_lane_invoke + 380 (queue.c:3991)
25  libdispatch.dylib               0x00000001acf28cb4 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6998)
26  libdispatch.dylib               0x00000001acf28528 _dispatch_workloop_worker_thread + 404 (queue.c:6592)
27  libsystem_pthread.dylib         0x0000000201ec7934 _pthread_wqthread + 288 (pthread.c:2696)
28  libsystem_pthread.dylib         0x0000000201ec40cc start_wqthread + 8 (:-1)

Thread 14:
0   libsystem_pthread.dylib         0x0000000201ec40c4 start_wqthread + 0 (:-1)

Thread 15:
0   libsystem_pthread.dylib         0x0000000201ec40c4 start_wqthread + 0 (:-1)

Thread 16:
0   libsystem_pthread.dylib         0x0000000201ec40c4 start_wqthread + 0 (:-1)

Thread 17:
0   libsystem_pthread.dylib         0x0000000201ec40c4 start_wqthread + 0 (:-1)

Thread 18:
0   libsystem_pthread.dylib         0x0000000201ec40c4 start_wqthread + 0 (:-1)

Thread 19:
0   libsystem_pthread.dylib         0x0000000201ec40c4 start_wqthread + 0 (:-1)

Thread 20:
0   libsystem_kernel.dylib          0x00000001ee1261cc __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x0000000201ec66e4 _pthread_cond_wait + 1228 (pthread_cond.c:862)
2   LightningDevKit                 0x00000001065a9ed4 std::sys::unix::locks::pthread_condvar::Condvar::wait_timeout::ha197540a97acc1dc + 240
3   LightningDevKit                 0x000000010649ac8c std::sync::condvar::Condvar::wait_timeout_while::he9af91245c745e35 + 192
4   LightningDevKit                 0x000000010648a9c0 lightning::util::wakers::Sleeper::wait_timeout::hfb8b646d86fe8f51 + 124
5   LightningDevKit                 0x000000010610a3cc std::sys_common::backtrace::__rust_begin_short_backtrace::h621d563d0ecf36b0 + 1240
6   LightningDevKit                 0x000000010614c584 core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::hf0f1bddc700f7171 + 220
7   LightningDevKit                 0x00000001065ae1d4 std::sys::unix::thread::Thread::new::thread_start::h528bd37d5f661c7b + 36
8   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
9   libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 21:
0   libsystem_kernel.dylib          0x00000001ee135268 poll + 8 (:-1)
1   LightningDevKit                 0x0000000105be15c4 sock_thread_fn + 204 (ldk_net.c:221)
2   libsystem_pthread.dylib         0x0000000201ec906c _pthread_start + 136 (pthread.c:931)
3   libsystem_pthread.dylib         0x0000000201ec40d8 thread_start + 8 (:-1)

Thread 13 crashed with ARM Thread State (64-bit):
    x0: 0x000000016bed9c80   x1: 0x0000000000000000   x2: 0x000000016beda270   x3: 0x000000016beda230
    x4: 0x00038863be981793   x5: 0x000a9ed183e25402   x6: 0x00038863be981793   x7: 0x000040b66ecfd71c
    x8: 0x000000016beda1d8   x9: 0x2a80975c3b483886  x10: 0x000d09a34b335035  x11: 0x4022029ccf9f2a41
   x12: 0x0000342eac98d8c0  x13: 0x000a9ed183e25402  x14: 0x0007ac8a4f303b2a  x15: 0x000e9ce024118170
   x16: 0x00038863be981793  x17: 0x00002a80975c3b48  x18: 0x0000000000000000  x19: 0x000000016bed9c80
   x20: 0x0000000107b62000  x21: 0x000000016beda1d8  x22: 0x000000016beda230  x23: 0x000000016beda270
   x24: 0x0000000000000000  x25: 0x0000000000002607  x26: 0x00000000d2d94122  x27: 0x000000016beda370
   x28: 0x000000030119c6c0   fp: 0x000000016bed9a30   lr: 0x00000001062bf264
    sp: 0x000000016bed98f0   pc: 0x00000001062bbcfc cpsr: 0x60001000
   esr: 0x92000006 (Data Abort) byte read Translation fault

Binary Images:
        0x1040c4000 -         0x1050b7fff bitkit arm64  <5c4f36a01a8d3de4b912b69aa259f174> /private/var/containers/Bundle/Application/55ED816A-A352-44D3-B32D-ABD4359ACB1C/bitkit.app/bitkit
        0x105474000 -         0x10562ffff OpenSSL arm64  <8a5f47e48dd83ebe88058434fbfb6bfb> /private/var/containers/Bundle/Application/55ED816A-A352-44D3-B32D-ABD4359ACB1C/bitkit.app/Frameworks/OpenSSL.framework/OpenSSL
        0x105a50000 -         0x105a5bfff libobjc-trampolines.dylib arm64e  <2e2c05f8377a30899ad91926d284dd03> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
        0x105bdc000 -         0x106877fff LightningDevKit arm64  <6e49dd867e7a39d18876f8b979764b5a> /private/var/containers/Bundle/Application/55ED816A-A352-44D3-B32D-ABD4359ACB1C/bitkit.app/Frameworks/LightningDevKit.framework/LightningDevKit
        0x106d6c000 -         0x106f3bfff hermes arm64  <8a13f69d6c1130da99593d1bc0365ce1> /private/var/containers/Bundle/Application/55ED816A-A352-44D3-B32D-ABD4359ACB1C/bitkit.app/Frameworks/hermes.framework/hermes
        0x1a3e99000 -         0x1a4a0efff Foundation arm64e  <3d3a12e3f5e9361fb00a4a5e8861aa55> /System/Library/Frameworks/Foundation.framework/Foundation
        0x1a4fed000 -         0x1a551afff CoreFoundation arm64e  <00e76a98210c3cb5930bf236807ff24c> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
        0x1a6123000 -         0x1a64fffff CFNetwork arm64e  <a5124019e235371686c7e75cf0163945> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
        0x1a726e000 -         0x1a8d8efff UIKitCore arm64e  <1741fa374e53371e8daed611aab0043d> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
        0x1acf12000 -         0x1acf58fff libdispatch.dylib arm64e  <81d355df266a3010bab8113b76a206c1> /usr/lib/system/libdispatch.dylib
        0x1acf59000 -         0x1acfd6ff3 libsystem_c.dylib arm64e  <b122f07fa15637f3a22d64627c0c4b24> /usr/lib/system/libsystem_c.dylib
        0x1b5419000 -         0x1b54a2fff libc++.1.dylib arm64e  <badf6383449432f297ef716ea17420f6> /usr/lib/libc++.1.dylib
        0x1c86b5000 -         0x1c8741ef7 dyld arm64e  <71846eacee653697bf7d790b6a07dcdb> /usr/lib/dyld
        0x1e9eef000 -         0x1e9ef7fff GraphicsServices arm64e  <c19b2aeb6aa83f998a53f76c7a0d98fe> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
        0x1ee11f000 -         0x1ee158fef libsystem_kernel.dylib arm64e  <13b5134e819c3baab3004856112114cb> /usr/lib/system/libsystem_kernel.dylib
        0x201ec3000 -         0x201ecfff3 libsystem_pthread.dylib arm64e  <1196b6c3333d3450818ff3663484b8eb> /usr/lib/system/libsystem_pthread.dylib

EOF
Jasonvdb commented 3 months ago

Thanks it looks like maybe switching off the peer manager when the app goes into the background while it is making a connection adding peers is causing this. Will look into it

JeanlChristophe commented 1 month ago

Fix https://github.com/synonymdev/react-native-ldk/pull/249