Starscream
Starscream copied to clipboard
IOS11 Disconnect not fires delegate
Hey, I tried to upgrade to the latest version (4.0.3), but found several problems at iOS 11:
-
WebSocket function
disconnect
don't fires delegate methodfunc didReceive(event: WebSocketEvent, client: WebSocket)
(in 3.0.6 version it always triggers disconnect func with or without error) -
Periodic crash:
_inputStreamCallbackFunc
Crashed: com.vluxe.starscream.websocket
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000003b70ebeb8
Crashed: com.vluxe.starscream.websocket
0 libobjc.A.dylib 0x180978910 objc_msgSend + 16
1 CoreFoundation 0x181743068 _inputStreamCallbackFunc + 56
2 CoreFoundation 0x1816e3b34 _signalEventSync + 212
3 CoreFoundation 0x181761ea4 ___signalEventQueue_block_invoke + 24
4 libdispatch.dylib 0x18109caa0 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x18109ca60 _dispatch_client_callout + 16
6 libdispatch.dylib 0x1810a69b4 _dispatch_queue_serial_drain$VARIANT$mp + 608
7 libdispatch.dylib 0x1810a72fc _dispatch_queue_invoke$VARIANT$mp + 336
8 libdispatch.dylib 0x1810a7cc8 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 340
9 libdispatch.dylib 0x1810b0098 _dispatch_workloop_worker_thread$VARIANT$mp + 668
10 libsystem_pthread.dylib 0x1813cfe70 _pthread_wqthread + 860
11 libsystem_pthread.dylib 0x1813cfb08 start_wqthread + 4
In https://github.com/daltoniam/Starscream/issues/676 also someone wrote that it crashed in ios 10 and 11.
Thanks
For me is happening something similar, but in iOS 13. I keep the app in foreground and after some time the app stop receiving WebSocket messages (that start happening after upgrading to latest version of the library 4.0.3, previously i was in version 3.x.x), the interesting part is that no disconnection/error/cancelled callback is called.
Just notice that after sending the app to background/foreground the callback reconnectSuggested
is called (which i guess imply the socket was disconnect, but not notified)
have same issue too. crash only iOS < 12
crash: com.vluxe.starscream.websocket EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000003136abeb8 _inputStreamCallbackFunc keyboard_arrow_down
Crashed: com.vluxe.starscream.websocket
0 libobjc.A.dylib 0x184c64430 objc_msgSend + 16
1 CoreFoundation 0x1859a27ac _inputStreamCallbackFunc + 56
2 CoreFoundation 0x1859424d0 _signalEventSync + 212
3 CoreFoundation 0x1859c1378 ___signalEventQueue_block_invoke + 24
4 libdispatch.dylib 0x185386a54 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x185386a14 _dispatch_client_callout + 16
6 libdispatch.dylib 0x1853c504c _dispatch_queue_serial_drain$VARIANT$armv81 + 520
7 libdispatch.dylib 0x1853c59bc _dispatch_queue_invoke$VARIANT$armv81 + 340
8 libdispatch.dylib 0x1853c63a8 _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 384
9 libdispatch.dylib 0x1853ce4b0 _dispatch_workloop_worker_thread$VARIANT$armv81 + 640
10 libsystem_pthread.dylib 0x18562ef1c _pthread_wqthread + 932
11 libsystem_pthread.dylib 0x18562eb6c start_wqthread + 4
com.vluxe.starscream.websocket keyboard_arrow_up
com.vluxe.starscream.websocket
0 libsystem_kernel.dylib 0x1854fb568 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1854fb3e0 mach_msg + 72
2 CoreFoundation 0x1859b2308 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x1859afed4 __CFRunLoopRun + 1424
4 CoreFoundation 0x1858cfe58 CFRunLoopRunSpecific + 436
5 CFNetwork 0x186072414 SocketStream::write(__CFWriteStream*, unsigned char const*, long, CFStreamError*) + 448
6 CoreFoundation 0x1858e98ec CFWriteStreamWrite + 516
7 ----------- 0x103308bec FoundationTransport.write(data:completion:) + 122 (FoundationTransport.swift:122)
8 ----------- 0x103320820 WSEngine.connectionChanged(state:) + 4343957536 (<compiler-generated>:4343957536)
9 ----------- 0x103309418 FoundationTransport.stream(_:handle:) + 4343862296 (<compiler-generated>:4343862296)
10 ----------- 0x10330993c @objc FoundationTransport.stream(_:handle:) + 4343863612 (<compiler-generated>:4343863612)
11 CoreFoundation 0x1859424d0 _signalEventSync + 212
12 CoreFoundation 0x1859c1378 ___signalEventQueue_block_invoke + 24
13 libdispatch.dylib 0x185386a54 _dispatch_call_block_and_release + 24
14 libdispatch.dylib 0x185386a14 _dispatch_client_callout + 16
15 libdispatch.dylib 0x1853c504c _dispatch_queue_serial_drain$VARIANT$armv81 + 520
16 libdispatch.dylib 0x1853c59bc _dispatch_queue_invoke$VARIANT$armv81 + 340
17 libdispatch.dylib 0x1853c63a8 _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 384
18 libdispatch.dylib 0x1853ce4b0 _dispatch_workloop_worker_thread$VARIANT$armv81 + 640
19 libsystem_pthread.dylib 0x18562ef1c _pthread_wqthread + 932
20 libsystem_pthread.dylib 0x18562eb6c start_wqthread + 4
The bad access might be fixed with https://github.com/daltoniam/Starscream/pull/777. Nevertheless the delegate isn't being called. I've tried to debug this and what I found was that FoundationTransport.swift:101 doesn't seem to return properly, but not sure why (I sometimes get a timeout error while disconnecting)
Any steps to reproduce, sample projects, etc would be appreciated.