New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 9 - Got LiteCore error: connection closed abnormally - eventual crash #2122

Closed
ascendancy05 opened this Issue Mar 27, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@ascendancy05

ascendancy05 commented Mar 27, 2018

As a follow up to #2097, I have continued @jayzhanghs testing and am seeing the following behavior

2018-03-27 12:35:33.641 HandshakeHD[67686:5135686] CouchbaseLite WS WARNING: {C4SocketImpl#120}==> litecore::websocket::C4SocketImpl wss:sync-staging.handshake.com:4984/db/_blipsync
2018-03-27 12:35:33.641 HandshakeHD[67686:5135686] CouchbaseLite WS WARNING: {C4SocketImpl#120} Unexpected or unclean socket disconnect! (reason=WebSocket status, code=1000)
2018-03-27 12:35:33.642 HandshakeHD[67686:5133422] CouchbaseLite Sync ERROR: {Repl#120}==> litecore::repl::Replicator /Users/ascendancy05/Library/Developer/CoreSimulator/Devices/C03541D3-2B93-43C4-97B8-97E4EAC79815/data/Containers/Data/Application/46F82063-847F-435B-8F41-B96705E2FF0D/Library/Application Support/CouchbaseLite/staging.handshake.com 57711c32-c1a1-4e6b-88d6-07700d7de020.cblite2/ ->wss:sync-staging.handshake.com:4984/db/_blipsync
2018-03-27 12:35:33.642 HandshakeHD[67686:5133422] CouchbaseLite Sync ERROR: {Repl#120} Got LiteCore error: connection closed abnormally (6/1006)

After about 5 to 15 minutes of this just happening over and over every few seconds, we eventually we get a EXC_BAD_ACCESS crash with a very unhelpful stack trace, and now get this every time we relaunch the app

* thread #20, queue = 'com.apple.NSURLSession.streamTask_work', stop reason = EXC_BAD_ACCESS (code=1, address=0xa4)
  * frame #0: 0x000000010b56dbec libdispatch.dylib`dispatch_source_set_timer + 13
    frame #1: 0x0000000109104ab8 CFNetwork`-[__NSCFURLLocalStreamTask _onqueue_ioTick] + 2534
    frame #2: 0x000000010b57f49b libdispatch.dylib`_dispatch_client_callout + 8
    frame #3: 0x000000010b5728a5 libdispatch.dylib`_dispatch_source_latch_and_call + 1750
    frame #4: 0x000000010b56d830 libdispatch.dylib`_dispatch_source_invoke + 1057
    frame #5: 0x000000010b5657fb libdispatch.dylib`_dispatch_queue_drain + 1818
    frame #6: 0x000000010b564ea9 libdispatch.dylib`_dispatch_queue_invoke + 601
    frame #7: 0x000000010b567af2 libdispatch.dylib`_dispatch_root_queue_drain + 1420
    frame #8: 0x000000010b567561 libdispatch.dylib`_dispatch_worker_thread3 + 111
    frame #9: 0x000000010b8ab1ca libsystem_pthread.dylib`_pthread_wqthread + 1387
    frame #10: 0x000000010b8aac4d libsystem_pthread.dylib`start_wqthread + 13

This is what the CBL thread was up to at the same time as this crash

* thread #9, queue = 'BLIP[->wss:sync-staging.handshake.com:4984/db/_blipsync]'
  * frame #0: 0x000000010b7bd629 libsystem_blocks.dylib`_Block_copy_internal + 465
    frame #1: 0x000000010b7bd9a3 libsystem_blocks.dylib`_Block_object_assign + 393
    frame #2: 0x000000010b7bd59d libsystem_blocks.dylib`_Block_copy_internal + 325
    frame #3: 0x000000010b725ee1 libdispatch.dylib`_dispatch_Block_copy + 43
    frame #4: 0x000000010b729be6 libdispatch.dylib`dispatch_async + 57
    frame #5: 0x0000000108b0bc11 CouchbaseLiteSwift`___lldb_unnamed_symbol3629$$CouchbaseLiteSwift + 241
    frame #6: 0x0000000108c92b13 CouchbaseLiteSwift`litecore::blip::Connection::closed(litecore::websocket::CloseStatus) + 211
    frame #7: 0x0000000108c92592 CouchbaseLiteSwift`litecore::blip::BLIPIO::_closed(litecore::websocket::CloseStatus) + 466
    frame #8: 0x0000000108c92980 CouchbaseLiteSwift`___lldb_unnamed_symbol4894$$CouchbaseLiteSwift + 80
    frame #9: 0x0000000108c87169 CouchbaseLiteSwift`___lldb_unnamed_symbol4837$$CouchbaseLiteSwift + 9
    frame #10: 0x0000000108c870e6 CouchbaseLiteSwift`___lldb_unnamed_symbol4834$$CouchbaseLiteSwift + 22
    frame #11: 0x000000010b725ef9 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #12: 0x000000010b74649b libdispatch.dylib`_dispatch_client_callout + 8
    frame #13: 0x000000010b72c988 libdispatch.dylib`_dispatch_queue_drain + 2215
    frame #14: 0x000000010b72bea9 libdispatch.dylib`_dispatch_queue_invoke + 601
    frame #15: 0x000000010b72eaf2 libdispatch.dylib`_dispatch_root_queue_drain + 1420
    frame #16: 0x000000010b72e561 libdispatch.dylib`_dispatch_worker_thread3 + 111
    frame #17: 0x000000010ba771ca libsystem_pthread.dylib`_pthread_wqthread + 1387
    frame #18: 0x000000010ba76c4d libsystem_pthread.dylib`start_wqthread + 13

  • Version: DB23+
  • Client OS: iOS 9.0
  • Server: SG 2.0 Beta2
@snej

This comment has been minimized.

Member

snej commented Mar 27, 2018

The error logs look as though the server was closing the WebSocket unexpectedly. Are there any warning/error logs from Sync Gateway at the time this occurred?

The crash is on an internal dispatch queue used by NSURLSession, not directly involving any of our code. Could you post the full crash report?

@snej

This comment has been minimized.

Member

snej commented Mar 27, 2018

PS: Also, does this only occur on iOS 9?

@ascendancy05

This comment has been minimized.

ascendancy05 commented Mar 27, 2018

Only iOS 9. Oddly, cannot reproduce in iOS 9.3 or 9.2, just 9.0 so far. We don't support iOS 8 on our end

@djpongh djpongh added this to the 2.0.0 milestone Mar 30, 2018

@djpongh djpongh removed the P2: medium label Apr 4, 2018

@djpongh djpongh modified the milestones: 2.0.0, 2.1.0 Apr 11, 2018

@djpongh djpongh added icebox P2: medium and removed backlog labels Apr 11, 2018

@djpongh djpongh removed the P2: medium label May 18, 2018

@pasin

This comment has been minimized.

Contributor

pasin commented Aug 29, 2018

This issue will be fixed in 2.1 with the new CBLWebSocket implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment