socketio / socket.io-client-swift

Other
5.22k stars 842 forks source link

How can i fix this kind of crash?(specialized closure #1 in....) #1076

Open KonamiWu opened 6 years ago

KonamiWu commented 6 years ago

i get numbers of this kind of crash, what can i solve these problem? crash log:

0. Crashed: com.apple.main-thread

0 lollipop 0x102397348 specialized SocketService.handleMessageReply(data:method:) (SocketService.swift:93) 1 lollipop 0x102398ff4 specialized closure #1 in SocketService.addHandler() (SocketService.swift:255) 2 lollipop 0x10239a85c partial apply for closure #1 in SocketService.addHandler() (SocketService.swift) 3 SocketIO 0x1027a36a4 specialized SocketIOClient.handleEvent(:data:isInternalMessage:withAck:) (SocketIOClient.swift) 4 SocketIO 0x1027a5834 specialized SocketIOClient.handlePacket(:) (SocketIOClient.swift:368) 5 SocketIO 0x1027c4ae0 specialized SocketManager.parseEngineMessage(:) (SocketManager.swift:401) 6 SocketIO 0x1027c564c partial apply for closure #1 in SocketManager.parseEngineMessage(_:) + 60

nuclearace commented 6 years ago

@KonamiWu Just a stack trace isn't very helpful. Can you post some log output?

hansemannn commented 5 years ago

Getting the same crash here! Full log of the crashed thread:

Thread 0 Crashed:
0   JavaScriptCore                  0x000000022f24c820 JSC::LLInt::setUpCall+ 8091680 (JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*) + 304
1   JavaScriptCore                  0x000000022eb00014 llint_entry + 32212
2   JavaScriptCore                  0x000000022eafffb8 llint_entry + 32120
3   JavaScriptCore                  0x000000022eafffb8 llint_entry + 32120
4   JavaScriptCore                  0x000000022eafffb8 llint_entry + 32120
5   JavaScriptCore                  0x000000022eb0002c llint_entry + 32236
6   JavaScriptCore                  0x000000022eaf802c vmEntryToJavaScript + 316
7   JavaScriptCore                  0x000000022f19e228 JSC::Interpreter::executeCall+ 7377448 (JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 424
8   JavaScriptCore                  0x000000022f365878 JSC::profiledCall+ 9242744 (JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 196
9   JavaScriptCore                  0x000000022eb30b38 JSObjectCallAsFunction + 376
10  MyApp                           0x000000010006cf0c 0x100054000 + 102156
11  MyApp                           0x000000010072ed70 0x100054000 + 7187824
12  SocketIO                        0x000000010105eeb0 partial apply for thunk for @escaping @callee_unowned @convention(block) (@unowned NSArray, @unowned SocketAckEmitter) -> () + 143024 (<compiler-generated>:0)
13  SocketIO                        0x000000010105d3f4 specialized SocketIOClient.handleEvent(_:data:isInternalMessage:withAck:) + 136180 (<compiler-generated>:0)
14  SocketIO                        0x000000010105ae54 SocketIOClient.handlePacket(_:) + 126548 (<compiler-generated>:0)
15  SocketIO                        0x000000010107a200 specialized SocketManager._parseEngineMessage(_:) + 254464 (<compiler-generated>:0)
16  SocketIO                        0x000000010107928c partial apply for closure #1 in SocketManager.engineDidClose+ 250508 (reason:) + 32
17  SocketIO                        0x00000001010426f8 thunk for @escaping @callee_guaranteed () -> () + 26360 (<compiler-generated>:0)
18  libdispatch.dylib               0x00000002270a7d58 _dispatch_call_block_and_release + 32
19  libdispatch.dylib               0x00000002270a92f0 _dispatch_client_callout + 20
20  libdispatch.dylib               0x00000002270b4fe4 _dispatch_main_queue_callback_4CF + 1016
21  CoreFoundation                  0x0000000227631280 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
22  CoreFoundation                  0x000000022762bf24 __CFRunLoopRun + 1912
23  CoreFoundation                  0x000000022762b494 CFRunLoopRunSpecific + 452
24  GraphicsServices                0x00000002298debe8 GSEventRunModal + 104
25  UIKitCore                       0x000000025523a68c UIApplicationMain + 216
26  MyApp                           0x00000001000599b4 0x100054000 + 22964
27  libdyld.dylib                   0x00000002270e1050 start + 4
nuclearace commented 5 years ago

@hansemannn That stacktrace doesn't really help. It just shows that the library called back into your code, which then did some stuff that caused a crash. My gut tells me that it's something to do with dispatch queues. By default the library uses the main queue to dispatch callbacks to.