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

Crashed: com.walletconnect.sdk.network.monitor #1249

Open
light-cloud opened this issue Dec 4, 2023 · 11 comments
Open

Crashed: com.walletconnect.sdk.network.monitor #1249

light-cloud opened this issue Dec 4, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@light-cloud
Copy link

light-cloud commented Dec 4, 2023

Hi team, we’ve been receiving some crashes from com.walletconnect.sdk.network.monitor .
Was not able to reproduce these crashes. What could cause this?

Crash:

WebSocket.createHTTPRequest()
WebSocket.swift:591

In file WebSocket.swift:591 I see this:

request.setValue(headerWSConnectionValue, forHTTPHeaderField: headerWSConnectionName)

Environment:

OS/Version: 17.1.2
WalletConnect Version 1.9.1
Starscream Version 3.1.1
Xcode version 15.0.1

From Crashlytics:

Crashed: com.walletconnect.sdk.network.monitor
0  CoreFoundation                 0x6e44 CF_IS_OBJC + 76
1  CoreFoundation                 0x1256c CFGetAllocator + 48
2  CFNetwork                      0xdd5a8 _CFStreamErrorFromCFError + 1868
3  CFNetwork                      0xdf3f8 _CFStreamErrorFromCFError + 9628
4  CFNetwork                      0x2940 CFURLRequestSetHTTPHeaderFieldValue + 136
5  Foundation                     0x12e184 specialized URLRequest._applyMutation<A>(_:) + 336
6  TestApp                                        0xea2168 WebSocket.createHTTPRequest() + 591 (WebSocket.swift:591)
7  WalletConnectSwiftV2           0x34bbc closure #1 in AutomaticSocketConnectionHandler.setUpNetworkMonitoring() + 68 (AutomaticSocketConnectionHandler.swift:68)
8  Combine                        0x59b8 Subscribers.Sink.receive(_:) + 96
9  Combine                        0x5948 protocol witness for Subscriber.receive(_:) in conformance Subscribers.Sink<A, B> + 24
10 Combine                        0x29808 Publishers.Autoconnect.Inner.receive(_:) + 52
11 Combine                        0x29764 Publishers.Multicast.Inner.receive(_:) + 236
12 Combine                        0x2966c protocol witness for Subscriber.receive(_:) in conformance Publishers.Multicast<A, B>.Inner<A1> + 24
13 Combine                        0x22ec8 PassthroughSubject.Conduit.offer(_:) + 708
14 Combine                        0x22bf4 partial apply for closure #1 in PassthroughSubject.send(_:) + 68
15 Combine                        0x22b90 ConduitList.forEach(_:) + 272
16 Combine                        0x22a2c PassthroughSubject.send(_:) + 264
17 Combine                        0x1a1c8 SubjectSubscriber.receive(_:) + 188
18 Combine                        0x1a0fc protocol witness for Subscriber.receive(_:) in conformance SubjectSubscriber<A> + 24
19 Combine                        0x24de0 CurrentValueSubject.Conduit.offer(_:) + 784
20 Combine                        0x24ac0 partial apply for closure #1 in CurrentValueSubject.send(_:) + 68
21 Combine                        0x22b90 ConduitList.forEach(_:) + 272
22 Combine                        0x3981c CurrentValueSubject.send(_:) + 372
23 WalletConnectSwiftV2           0x830e8 closure #1 in NetworkMonitor.init() + 28 (NetworkMonitoring.swift:28)
24 Network                        0x16fd48 partial apply for closure #1 in NWPathMonitor.startLocked(lockedState:) + 92
25 Network                        0x166e28 thunk for @escaping @callee_guaranteed @Sendable () -> () + 36
26 libdispatch.dylib              0x26a8 _dispatch_call_block_and_release + 32
27 libdispatch.dylib              0x4300 _dispatch_client_callout + 20
28 libdispatch.dylib              0xb894 _dispatch_lane_serial_drain + 748
29 libdispatch.dylib              0xc3c4 _dispatch_lane_invoke + 380
30 libdispatch.dylib              0x17004 _dispatch_root_queue_drain_deferred_wlh + 288
31 libdispatch.dylib              0x16878 _dispatch_workloop_worker_thread + 404
32 libsystem_pthread.dylib        0x1964 _pthread_wqthread + 288
33 libsystem_pthread.dylib        0x1a04 start_wqthread + 8
@light-cloud light-cloud added the bug Something isn't working label Dec 4, 2023
@flypaper0
Copy link
Contributor

It's kind of strange that WebSocket.reconnect() is calling from com.walletconnect.sdk.network.monitor thread. Looks like concurrency issue. What crash message that you're receiving?

@light-cloud
Copy link
Author

I can see just this message in the report.

Crashed: com.walletconnect.sdk.network.monitor
EXC_BREAKPOINT 0x000000019cd4ae44
crash-report

@light-cloud
Copy link
Author

light-cloud commented Dec 5, 2023

Also this one:
 crash-report2

Crashed: com.walletconnect.sdk.network.monitor
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000030
Crashed: com.walletconnect.sdk.network.monitor
0  CoreFoundation                 0x3810 __CFBasicHashReplaceValue + 452
1  CoreFoundation                 0x2e80 CFDictionarySetValue + 208
2  CFNetwork                      0x208610 _CFHTTPServerResponseEnqueue + 24304
3  CFNetwork                      0xdf408 _CFStreamErrorFromCFError + 9644
4  CFNetwork                      0x2940 CFURLRequestSetHTTPHeaderFieldValue + 136
5  Foundation                     0x12e184 specialized URLRequest._applyMutation<A>(_:) + 336
6  TestApp                         0xea2250 WebSocket.createHTTPRequest() + 594 (WebSocket.swift:594)
7  WalletConnectSwiftV2           0x34bbc closure #1 in AutomaticSocketConnectionHandler.setUpNetworkMonitoring() + 68 (AutomaticSocketConnectionHandler.swift:68)
8  Combine                        0x59b8 Subscribers.Sink.receive(_:) + 96
9  Combine                        0x5948 protocol witness for Subscriber.receive(_:) in conformance Subscribers.Sink<A, B> + 24
10 Combine                        0x29808 Publishers.Autoconnect.Inner.receive(_:) + 52
11 Combine                        0x29764 Publishers.Multicast.Inner.receive(_:) + 236
12 Combine                        0x2966c protocol witness for Subscriber.receive(_:) in conformance Publishers.Multicast<A, B>.Inner<A1> + 24
13 Combine                        0x22ec8 PassthroughSubject.Conduit.offer(_:) + 708
14 Combine                        0x22bf4 partial apply for closure #1 in PassthroughSubject.send(_:) + 68
15 Combine                        0x22b90 ConduitList.forEach(_:) + 272
16 Combine                        0x22a2c PassthroughSubject.send(_:) + 264
17 Combine                        0x1a1c8 SubjectSubscriber.receive(_:) + 188
18 Combine                        0x1a0fc protocol witness for Subscriber.receive(_:) in conformance SubjectSubscriber<A> + 24
19 Combine                        0x24de0 CurrentValueSubject.Conduit.offer(_:) + 784
20 Combine                        0x24ac0 partial apply for closure #1 in CurrentValueSubject.send(_:) + 68
21 Combine                        0x22b90 ConduitList.forEach(_:) + 272
22 Combine                        0x3981c CurrentValueSubject.send(_:) + 372
23 WalletConnectSwiftV2           0x830e8 closure #1 in NetworkMonitor.init() + 28 (NetworkMonitoring.swift:28)
24 Network                        0x16fd48 partial apply for closure #1 in NWPathMonitor.startLocked(lockedState:) + 92
25 Network                        0x166e28 thunk for @escaping @callee_guaranteed @Sendable () -> () + 36
26 libdispatch.dylib              0x26a8 _dispatch_call_block_and_release + 32
27 libdispatch.dylib              0x4300 _dispatch_client_callout + 20
28 libdispatch.dylib              0xb894 _dispatch_lane_serial_drain + 748
29 libdispatch.dylib              0xc3c4 _dispatch_lane_invoke + 380
30 libdispatch.dylib              0x17004 _dispatch_root_queue_drain_deferred_wlh + 288
31 libdispatch.dylib              0x16878 _dispatch_workloop_worker_thread + 404
32 libsystem_pthread.dylib        0x1964 _pthread_wqthread + 288
33 libsystem_pthread.dylib        0x1a04 start_wqthread + 8

@light-cloud
Copy link
Author

@flypaper0 Just an assumption, but is it possible that two queues try to access the socket at the same time, causing the crash? If this assumption is valid, and I am not mistaken, is it possible to add some synchronization mechanism to protect against this in the WalletConnect code?

In AutomaticSocketConnectionHandler, in the debugger, I can see that com.walletconnect.sdk.network.monitor attempts to access the socket and reconnect when the internet appears/disappears, and another dispatcher queue com.apple.root.user-initiated-qos.cooperative when the socket disconnects.

55 77

@vehicles4real
Copy link

Please let me know if you can just put everything into my coinbase wallet at veicles70nova.cb.id

@wongzigii
Copy link

We received the same crash report from firebase.

Crashed: com.walletconnect.sdk.network.monitor
0 CoreFoundation 0xd454 __CFBasicHashDeallocate + 24
1 CoreFoundation 0xc120 CFRelease + 292
2 CFNetwork 0x2091fc CFHTTPServerResponseEnqueue + 23744
3 CoreFoundation 0xc120 CFRelease + 292
4 CFNetwork 0xddbe0 CFStreamErrorFromCFError + 2004
5 CFNetwork 0xdf9a8 CFStreamErrorFromCFError + 9628
6 CFNetwork 0x211c CFURLRequestSetHTTPHeaderFieldValue + 136
7 Foundation 0x12be58 specialized URLRequest.applyMutation(:) + 336
8 Starscream 0x11b54 $s10Starscream9WebSocketC17createHTTPRequest33_E91840E7069A0D2D302D042308E9D928LLyyF + 820
9 hebaoapp 0x1866ab4 closure #1 in AutomaticSocketConnectionHandler.setUpNetworkMonitoring() + 68 (AutomaticSocketConnectionHandler.swift:68)
10 Combine 0x59b8 Subscribers.Sink.receive(
:) + 96
11 Combine 0x5948 protocol witness for Subscriber.receive(
:) in conformance Subscribers.Sink<A, B> + 24
12 Combine 0x29808 Publishers.Autoconnect.Inner.receive(:) + 52
13 Combine 0x29764 Publishers.Multicast.Inner.receive(:) + 236
14 Combine 0x2966c protocol witness for Subscriber.receive(:) in conformance Publishers.Multicast<A, B>.Inner + 24
15 Combine 0x22ec8 PassthroughSubject.Conduit.offer(:) + 708
16 Combine 0x22bf4 partial apply for closure #1 in PassthroughSubject.send(
:) + 68
17 Combine 0x22b90 ConduitList.forEach(:) + 272
18 Combine 0x22a2c PassthroughSubject.send(
:) + 264
19 Combine 0x1a1c8 SubjectSubscriber.receive(:) + 188
20 Combine 0x1a0fc protocol witness for Subscriber.receive(
:) in conformance SubjectSubscriber + 24
21 Combine 0x24de0 CurrentValueSubject.Conduit.offer(:) + 784
22 Combine 0x24ac0 partial apply for closure #1 in CurrentValueSubject.send(
:) + 68
23 Combine 0x22b90 ConduitList.forEach(:) + 272
24 Combine 0x3981c CurrentValueSubject.send(
:) + 372
25 hebaoapp 0x1858e30 closure #1 in NetworkMonitor.init() + 28 (NetworkMonitoring.swift:28)
26 Network 0x1719fc partial apply for closure #1 in NWPathMonitor.startLocked(lockedState:) + 92
27 Network 0x168adc thunk for @escaping @callee_guaranteed @sendable () -> () + 36
28 libdispatch.dylib 0x26a8 _dispatch_call_block_and_release + 32
29 libdispatch.dylib 0x4300 _dispatch_client_callout + 20
30 libdispatch.dylib 0xb894 _dispatch_lane_serial_drain + 748
31 libdispatch.dylib 0xc3c4 _dispatch_lane_invoke + 380
32 libdispatch.dylib 0x17004 _dispatch_root_queue_drain_deferred_wlh + 288
33 libdispatch.dylib 0x16878 _dispatch_workloop_worker_thread + 404
34 libsystem_pthread.dylib 0x1964 _pthread_wqthread + 288
35 libsystem_pthread.dylib 0x1a04 start_wqthread + 8

@light-cloud
Copy link
Author

@flypaper0 Could you kindly provide any updates on the status of the issue? Thank you.

@simonmcl
Copy link

@flypaper0 / @llbartekll Got the same issue report in sentry. Had it happen in 2 versions now. Latest is 1.10.0

Screenshot 2024-02-20 at 09 41 25

@light-cloud
Copy link
Author

@flypaper0 / @llbartekll Could you kindly provide any updates on the status of the issue? Thank you.

@llbartekll
Copy link
Contributor

@light-cloud i think the issue should be resolved, do you still experience a crash?

@light-cloud
Copy link
Author

@llbartekll Thank you for your feedback! We will update our library to the latest version 1.19.4 to verify this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants