daltoniam / Starscream

Websockets in swift for iOS and OSX
Apache License 2.0
8.37k stars 1.21k forks source link

Crash in WebSocket.swift line 214 FoundationStream.connect #562

Closed ndreisg closed 5 years ago

ndreisg commented 6 years ago

Hi! I'm using the latest version (3.0.5) and get these crashes occasionally (they seem to be very rare) Am I doing something wrong? I am already connecting the WebSocket in applicationDidBecomeActive. Could this be a problem?

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0xdeadfa11
Termination Description: SPRINGBOARD, power down shortcut |  | ProcessVisibility: Foreground Obscured | ProcessState: Running
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001845afde8 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x00000001845afc60 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                  0x0000000184af2e40 __CFRunLoopServiceMachPort + 196 (CFRunLoop.c:2613)
3   CoreFoundation                  0x0000000184af0908 __CFRunLoopRun + 1568 (CFRunLoop.c:2969)
4   CoreFoundation                  0x0000000184a10da8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
5   GraphicsServices                0x00000001869f6020 GSEventRunModal + 100 (GSEvent.c:2245)
6   UIKit                           0x000000018ea30758 UIApplicationMain + 236 (UIApplication.m:3965)
7   Scan-IT                         0x000000010215591c main + 56 (ViewControllerWebSocketDelegate.swift:12)
8   libdyld.dylib                   0x00000001844a1fc0 start + 4

Thread 1:
0   libsystem_pthread.dylib         0x000000018476fb04 start_wqthread + 0

Thread 2 name:
Thread 2:
0   libsystem_kernel.dylib          0x00000001845afde8 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x00000001845afc60 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                  0x0000000184af2e40 __CFRunLoopServiceMachPort + 196 (CFRunLoop.c:2613)
3   CoreFoundation                  0x0000000184af0908 __CFRunLoopRun + 1568 (CFRunLoop.c:2969)
4   CoreFoundation                  0x0000000184a10da8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
5   Foundation                      0x0000000185485674 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 (NSRunLoop.m:367)
6   Foundation                      0x000000018548551c -[NSRunLoop(NSRunLoop) runUntilDate:] + 148 (NSRunLoop.m:411)
7   UIKit                           0x000000018e715768 -[UIEventFetcher threadMain] + 136 (UIEventFetcher.m:437)
8   Foundation                      0x0000000185595efc __NSThread__start__ + 1040 (NSThread.m:1181)
9   libsystem_pthread.dylib         0x0000000184771220 _pthread_body + 272 (pthread.c:740)
10  libsystem_pthread.dylib         0x0000000184771110 _pthread_start + 292 (pthread.c:799)
11  libsystem_pthread.dylib         0x000000018476fb10 thread_start + 4

Thread 3 name:
Thread 3:
0   libsystem_kernel.dylib          0x00000001845afde8 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x00000001845afc60 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                  0x0000000184af2e40 __CFRunLoopServiceMachPort + 196 (CFRunLoop.c:2613)
3   CoreFoundation                  0x0000000184af0908 __CFRunLoopRun + 1568 (CFRunLoop.c:2969)
4   CoreFoundation                  0x0000000184a10da8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
5   CoreFoundation                  0x0000000184b02074 _legacyStreamRunLoop_workThread + 268 (CFStream.c:1779)
6   libsystem_pthread.dylib         0x0000000184771220 _pthread_body + 272 (pthread.c:740)
7   libsystem_pthread.dylib         0x0000000184771110 _pthread_start + 292 (pthread.c:799)
8   libsystem_pthread.dylib         0x000000018476fb10 thread_start + 4

Thread 4 name:
Thread 4:
0   libsystem_kernel.dylib          0x00000001845afde8 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x00000001845afc60 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                  0x0000000184af2e40 __CFRunLoopServiceMachPort + 196 (CFRunLoop.c:2613)
3   CoreFoundation                  0x0000000184af0908 __CFRunLoopRun + 1568 (CFRunLoop.c:2969)
4   CoreFoundation                  0x0000000184a10da8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
5   CFNetwork                       0x000000018531e6e0 -[__CoreSchedulingSetRunnable runForever] + 220 (CoreSchedulingSet.mm:1365)
6   Foundation                      0x0000000185595efc __NSThread__start__ + 1040 (NSThread.m:1181)
7   libsystem_pthread.dylib         0x0000000184771220 _pthread_body + 272 (pthread.c:740)
8   libsystem_pthread.dylib         0x0000000184771110 _pthread_start + 292 (pthread.c:799)
9   libsystem_pthread.dylib         0x000000018476fb10 thread_start + 4

Thread 5 name:
Thread 5:
0   libsystem_kernel.dylib          0x00000001845d152c __select + 8
1   CoreFoundation                  0x0000000184afb378 __CFSocketManager + 644 (CFSocket.c:2241)
2   libsystem_pthread.dylib         0x0000000184771220 _pthread_body + 272 (pthread.c:740)
3   libsystem_pthread.dylib         0x0000000184771110 _pthread_start + 292 (pthread.c:799)
4   libsystem_pthread.dylib         0x000000018476fb10 thread_start + 4

Thread 6 name:
Thread 6:
0   libsystem_kernel.dylib          0x00000001845d1604 __semwait_signal + 8
1   libsystem_c.dylib               0x00000001844ea12c nanosleep + 212 (nanosleep.c:104)
2   libsystem_c.dylib               0x00000001844ea04c usleep + 64 (usleep.c:52)
3   Starscream                      0x00000001022b6610 closure #1 in FoundationStream.connect(url:port:timeout:ssl:completion:) + 96 (WebSocket.swift:214)
4   Starscream                      0x00000001022b59b4 thunk for @escaping @callee_guaranteed () -> () + 36 (WebSocket.swift:0)
5   libdispatch.dylib               0x000000018443caa0 _dispatch_call_block_and_release + 24 (init.c:994)
6   libdispatch.dylib               0x000000018443ca60 _dispatch_client_callout + 16 (object.m:507)
7   libdispatch.dylib               0x000000018447b1d4 _dispatch_queue_serial_drain$VARIANT$armv81 + 568 (inline_internal.h:2500)
8   libdispatch.dylib               0x000000018447baf8 _dispatch_queue_invoke$VARIANT$armv81 + 328 (queue.c:5290)
9   libdispatch.dylib               0x000000018447c49c _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 332 (queue.c:5908)
10  libdispatch.dylib               0x000000018448446c _dispatch_workloop_worker_thread$VARIANT$armv81 + 612 (source.c:2529)
11  libsystem_pthread.dylib         0x000000018476fe70 _pthread_wqthread + 860 (pthread.c:2218)
12  libsystem_pthread.dylib         0x000000018476fb08 start_wqthread + 4

Thread 7:
0   libsystem_pthread.dylib         0x000000018476fb04 start_wqthread + 0

Thread 8:
0   libsystem_pthread.dylib         0x000000018476fb04 start_wqthread + 0
fassko commented 6 years ago

Can you reproduce in smaller sample project? That could help us solve the issue. Thanks!