apollo-ios: Multiple Websocket Crashes after updating to 0.43.0
Bug report
Recently updated from 0.35.0 to 0.43.0 and have encountered a few new crashes related to websockets usage. Didn’t find any similar issues reported here but have found somewhat similar reports in the Starscream library, namely https://github.com/daltoniam/Starscream/issues/773. However that issue was supposedly resolved in the 4.0.4 Starscream release that is used in the latest (0.43.0) release of apollo-ios. Have requested more information on the status of that Starscream issue but am curious if anyone else using graphql subscriptions has encountered this issue? Only have a few different crash stack traces to work off of atm but will update as the investigation proceeds. Any assistance/insight is greatly appreciated!
Versions
Please fill in the versions you’re currently using:
apollo-ios
SDK version: 0.43.0- Xcode version: 12.5
- Swift version: 5.1
- Package manager: Cocoapods
Steps to reproduce
Have been unable to reproduce thus far.
Further details
Will update with more information as we gather it but for now here are the stack traces that we have collected from crashes thus far, starting with the one that has been most frequent.
Stack Trace 1:
EXC_BREAKPOINT 0x0000000197b15fb8
Crashed: com.vluxe.starscream.websocket
0 CoreFoundation 0x19aafb52c CFHash.cold.1 + 16
1 CoreFoundation 0x19aa08320 CFHash + 532
2 CoreFoundation 0x19aab3980 CFBasicHashGetCountOfKey + 212
3 CoreFoundation 0x19aa0ceac CFSetContainsValue + 100
4 CoreFoundation 0x19aa00574 CFRunLoopRemoveSource + 180
5 CFNetwork 0x19b19452c _CFStreamErrorFromCFError + 175344
6 CoreFoundation 0x19aa1ff80 CFWriteStreamWrite + 368
7 Starscream 0x106bfd68c FoundationTransport.write(data:completion:) + 127 (FoundationTransport.swift:127)
8 Starscream 0x106c13674 WSEngine.connectionChanged(state:) + 122 (WSEngine.swift:122)
9 Starscream 0x106bfe038 FoundationTransport.stream(_:handle:) + 207 (FoundationTransport.swift:207)
10 Starscream 0x106bfe26c @objc FoundationTransport.stream(_:handle:) + 4407140972 (<compiler-generated>:4407140972)
11 CoreFoundation 0x19aa21c1c _signalEventSync + 216
12 CoreFoundation 0x19aa21d34 ___signalEventQueue_block_invoke + 28
13 libdispatch.dylib 0x19a67c24c _dispatch_call_block_and_release + 32
14 libdispatch.dylib 0x19a67ddb0 _dispatch_client_callout + 20
15 libdispatch.dylib 0x19a68510c _dispatch_lane_serial_drain + 580
16 libdispatch.dylib 0x19a685c5c _dispatch_lane_invoke + 408
17 libdispatch.dylib 0x19a68fd78 _dispatch_workloop_worker_thread + 708
18 libsystem_pthread.dylib 0x1e6535814 _pthread_wqthread + 276
19 libsystem_pthread.dylib 0x1e653c76c start_wqthread + 8
Stack Trace 2:
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x0000001000000014
Crashed: com.vluxe.starscream.websocket
0 libobjc.A.dylib 0x1b5c27230 objc_opt_respondsToSelector + 20
1 CoreFoundation 0x1a17ef9c8 _inputStreamCallbackFunc + 48
2 CoreFoundation 0x1a1820f4c _signalEventSync + 212
3 CoreFoundation 0x1a1820fac ___signalEventQueue_block_invoke + 24
4 libdispatch.dylib 0x1a14bd298 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x1a14be280 _dispatch_client_callout + 16
6 libdispatch.dylib 0x1a149a4f0 _dispatch_lane_serial_drain$VARIANT$armv81 + 568
7 libdispatch.dylib 0x1a149afdc _dispatch_lane_invoke$VARIANT$armv81 + 404
8 libdispatch.dylib 0x1a14a4800 _dispatch_workloop_worker_thread + 692
9 libsystem_pthread.dylib 0x1ea0155a4 _pthread_wqthread + 272
10 libsystem_pthread.dylib 0x1ea018874 start_wqthread + 8
Stack Trace 3:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
Crashed: com.vluxe.starscream.websocket
0 libobjc.A.dylib 0x1a0372110 objc_msgSend + 48
1 CoreFoundation 0x18b2c25cc _inputStreamCallbackFunc + 52
2 CoreFoundation 0x18b2f5c1c _signalEventSync + 216
3 CoreFoundation 0x18b2f5d34 ___signalEventQueue_block_invoke + 28
4 libdispatch.dylib 0x18af5024c _dispatch_call_block_and_release + 32
5 libdispatch.dylib 0x18af51db0 _dispatch_client_callout + 20
6 libdispatch.dylib 0x18af5910c _dispatch_lane_serial_drain + 580
7 libdispatch.dylib 0x18af59c5c _dispatch_lane_invoke + 408
8 libdispatch.dylib 0x18af63d78 _dispatch_workloop_worker_thread + 708
9 libsystem_pthread.dylib 0x1d6e09814 _pthread_wqthread + 276
10 libsystem_pthread.dylib 0x1d6e1076c start_wqthread + 8
Stack Trace 4:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS
Crashed: com.vluxe.starscream.websocket
0 libobjc.A.dylib 0x1a7575af4 objc_loadWeakRetained + 148
1 Starscream 0x1024cdc00 FoundationTransport.read() + 174 (FoundationTransport.swift:174)
2 Starscream 0x1024ce26c @objc FoundationTransport.stream(_:handle:) + 4407288428 (<compiler-generated>:4407288428)
3 CoreFoundation 0x1924d5c1c _signalEventSync + 216
4 CoreFoundation 0x1924d5d34 ___signalEventQueue_block_invoke + 28
5 libdispatch.dylib 0x19213024c _dispatch_call_block_and_release + 32
6 libdispatch.dylib 0x192131db0 _dispatch_client_callout + 20
7 libdispatch.dylib 0x19213910c _dispatch_lane_serial_drain + 580
8 libdispatch.dylib 0x192139c5c _dispatch_lane_invoke + 408
9 libdispatch.dylib 0x192143d78 _dispatch_workloop_worker_thread + 708
10 libsystem_pthread.dylib 0x1ddfe9814 _pthread_wqthread + 276
11 libsystem_pthread.dylib 0x1ddff076c start_wqthread + 8
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (19 by maintainers)
unregister notification for read_timeout failed
seems…less than promising, I think that’s under the hood not just of Starscream but of Apple’s web socket implementation.Will try to dive in to this.
I upgraded to 0.43.0 and it was still happening.
Related,
Enabling the SplitNetworkTransport, and including the web socket results in massive memory leaks, in 12 minutes alone it generated 2.2gs of memory.
I have encountered exactly the the same issue. Downgrading to Apollo GraphQL version 0.41.0 with StarScream 3.1.1 fixed crashing.
Yep didn’t expect anyone to have a solve looking at these stack traces, was more looking to see if anyone else has encountered anything similar while upgrading to the more recent versions of apollo-ios (that include Starscream 4.x.x) that might aid in the information gathering and investigation of the issue. Will keep this thread updated accordingly.