Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Crash on reconnect #9

Open
psi-gh opened this issue Feb 20, 2018 · 5 comments
Open

Crash on reconnect #9

psi-gh opened this issue Feb 20, 2018 · 5 comments

Comments

@psi-gh
Copy link

psi-gh commented Feb 20, 2018

I have such crash. It occurring in ~1 minute after running app if I specify reconnect: true in gql.initServer(connectionParams: nil, reconnect: true)
If I set reconnect to false, there won't be crash, but subscription will stop in 1 minute without any notice.

*** Assertion failure in -[SRWebSocket open], /Pods/SocketRocket/SocketRocket/SRWebSocket.m:389
 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot call -(void)open on SRWebSocket more than once'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010444c12b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x0000000100e17f41 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001044512f2 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x00000001008b8d69 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
	4   SocketRocket                        0x00000001007ca323 -[SRWebSocket open] + 355
	5   LiveGQL                             0x000000010079d8e0 _T07LiveGQLAAC9webSocketySQySo05SRWebD0CG_Si16didCloseWithCodeSQySSG6reasonSb8wasCleantF + 192
	6   LiveGQL                             0x000000010079d9fd _T07LiveGQLAAC9webSocketySQySo05SRWebD0CG_Si16didCloseWithCodeSQySSG6reasonSb8wasCleantFTo + 253
	7   SocketRocket                        0x00000001007d3fcb __34-[SRWebSocket stream:handleEvent:]_block_invoke_3 + 187
	8   libdispatch.dylib                   0x0000000105c2c2f7 _dispatch_call_block_and_release + 12
	9   libdispatch.dylib                   0x0000000105c2d33d _dispatch_client_callout + 8
	10  libdispatch.dylib                   0x0000000105c385f9 _dispatch_main_queue_callback_4CF + 628
	11  CoreFoundation                      0x000000010440ee39 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	12  CoreFoundation                      0x00000001043d3462 __CFRunLoopRun + 2402
	13  CoreFoundation                      0x00000001043d2889 CFRunLoopRunSpecific + 409
	14  GraphicsServices                    0x0000000109a779c6 GSEventRunModal + 62
	15  UIKit                               0x00000001016b45d6 UIApplicationMain + 159
	16  xxxxxxxx                            0x00000001003842c7 main + 55
	17  libdyld.dylib                       0x0000000105ca9d81 start + 1
	18  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException`
@florianmari
Copy link
Owner

Hey!

Thank you for reporting this, I'm gonna check and add some unit tests for the future!

@aparandiy
Copy link

Hi, have the same issue - app crashes after few minutes, reason - 'Cannot call -(void)open on SRWebSocket more than once'

@psi-gh
Copy link
Author

psi-gh commented Oct 9, 2018

@aparandiy Seems like this repo not supporting. You can look at Apollo project.

@aparandiy
Copy link

if I am listening for subscriptions from one controller - all works perfect, but if i connect subscriptions more than one controller - it works, but after few minutes of using the app crashes with reason - Cannot call -(void)open on SRWebSocket more than once

@florianmari
Copy link
Owner

Ok I see where is the bug, I need to rush and push two solutions:

  • The fix of this one, it looks be okay to fix and to think a new architecture
  • Add heartbeat to avoid disconnect

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants