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

testSelfSignedSSLFailure_SG failed on iOS 10.2 #2094

Closed
pasin opened this Issue Mar 7, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@pasin
Contributor

pasin commented Mar 7, 2018

Log:

Test Case '-[ReplicatorTest testSelfSignedSSLFailure_SG]' started.
2018-03-07 10:43:59.409 xctest[1546:18011] CouchbaseLite default log level is Debug and above
2018-03-07 10:43:59.468 xctest[1546:18011] ---Status: connecting (0 / 0), lastError = (null)
2018-03-07 10:43:59.489 xctest[1546:18084] CouchbaseLite WS WARNING: TLS handshake failed: <NSURLProtectionSpace: 0x602000019290>: Host:localhost, Server:https, Auth-Scheme:NSURLAuthenticationMethodServerTrust, Realm:(null), Port:4994, Proxy:NO, Proxy-Type:(null): Server has self-signed or unknown root SSL certificate
2018-03-07 10:43:59.506 xctest[1546:18084] CouchbaseLite WS WARNING: {C4SocketImpl#1}==> litecore::websocket::C4SocketImpl wss:localhost:4994/scratch/_blipsync
2018-03-07 10:43:59.506 xctest[1546:18084] CouchbaseLite WS WARNING: {C4SocketImpl#1} Unexpected or unclean socket disconnect! (reason=errno, code=54)
2018-03-07 10:43:59.507 xctest[1546:18088] CouchbaseLite Sync ERROR: {Repl#2}==> litecore::repl::Replicator /Users/pasin/Library/Developer/CoreSimulator/Devices/0CE9DA16-4FAC-4146-A9B6-1B20FF66B067/data/tmp/CouchbaseLite_EE/testdb.cblite2/ ->wss:localhost:4994/scratch/_blipsync
2018-03-07 10:43:59.508 xctest[1546:18088] CouchbaseLite Sync ERROR: {Repl#2} Got LiteCore error: Connection reset by peer (2/54)
2018-03-07 10:43:59.667 xctest[1546:18011] ---Status: offline (0 / 0), lastError = Connection reset by peer
2018-03-07 10:44:01.714 xctest[1546:18011] ---Status: connecting (0 / 0), lastError = (null)
2018-03-07 10:44:01.725 xctest[1546:18088] CouchbaseLite WS WARNING: TLS handshake failed: <NSURLProtectionSpace: 0x602000019530>: Host:localhost, Server:https, Auth-Scheme:NSURLAuthenticationMethodServerTrust, Realm:(null), Port:4994, Proxy:NO, Proxy-Type:(null): Server has self-signed or unknown root SSL certificate
2018-03-07 10:44:01.726 xctest[1546:18088] CouchbaseLite WS WARNING: {C4SocketImpl#3}==> litecore::websocket::C4SocketImpl wss:localhost:4994/scratch/_blipsync
2018-03-07 10:44:01.726 xctest[1546:18088] CouchbaseLite WS WARNING: {C4SocketImpl#3} Unexpected or unclean socket disconnect! (reason=errno, code=54)
2018-03-07 10:44:01.727 xctest[1546:18084] CouchbaseLite Sync ERROR: {Repl#4}==> litecore::repl::Replicator /Users/pasin/Library/Developer/CoreSimulator/Devices/0CE9DA16-4FAC-4146-A9B6-1B20FF66B067/data/tmp/CouchbaseLite_EE/testdb.cblite2/ ->wss:localhost:4994/scratch/_blipsync
2018-03-07 10:44:01.727 xctest[1546:18084] CouchbaseLite Sync ERROR: {Repl#4} Got LiteCore error: Connection reset by peer (2/54)
2018-03-07 10:44:01.917 xctest[1546:18011] ---Status: offline (0 / 0), lastError = Connection reset by peer
2018-03-07 10:44:05.957 xctest[1546:18011] ---Status: connecting (0 / 0), lastError = (null)
2018-03-07 10:44:05.966 xctest[1546:18065] CouchbaseLite WS WARNING: TLS handshake failed: <NSURLProtectionSpace: 0x602000019810>: Host:localhost, Server:https, Auth-Scheme:NSURLAuthenticationMethodServerTrust, Realm:(null), Port:4994, Proxy:NO, Proxy-Type:(null): Server has self-signed or unknown root SSL certificate
2018-03-07 10:44:05.967 xctest[1546:18094] CouchbaseLite WS WARNING: {C4SocketImpl#5}==> litecore::websocket::C4SocketImpl wss:localhost:4994/scratch/_blipsync
2018-03-07 10:44:05.967 xctest[1546:18094] CouchbaseLite WS WARNING: {C4SocketImpl#5} Unexpected or unclean socket disconnect! (reason=errno, code=54)
2018-03-07 10:44:05.968 xctest[1546:18094] CouchbaseLite Sync ERROR: {Repl#6}==> litecore::repl::Replicator /Users/pasin/Library/Developer/CoreSimulator/Devices/0CE9DA16-4FAC-4146-A9B6-1B20FF66B067/data/tmp/CouchbaseLite_EE/testdb.cblite2/ ->wss:localhost:4994/scratch/_blipsync
2018-03-07 10:44:05.968 xctest[1546:18094] CouchbaseLite Sync ERROR: {Repl#6} Got LiteCore error: Connection reset by peer (2/54)
2018-03-07 10:44:06.161 xctest[1546:18011] ---Status: stopped (0 / 0), lastError = Connection reset by peer
/Users/pasin/Git/couchbase-lite-ios/Objective-C/Tests/ReplicatorTest.m:244: error: -[ReplicatorTest testSelfSignedSSLFailure_SG] : ((s.error.code) equal to (code)) failed: ("302") is not equal to ("-1203")
/Users/pasin/Git/couchbase-lite-ios/Objective-C/Tests/ReplicatorTest.m:246: error: -[ReplicatorTest testSelfSignedSSLFailure_SG] : ((s.error.domain) equal to (domain)) failed: ("kCFErrorDomainCFNetwork") is not equal to ("NSURLErrorDomain")

Note: Test passed with iOS 11.2.

@pasin pasin added this to the 2.0.0 milestone Mar 7, 2018

@pasin pasin self-assigned this Mar 7, 2018

@pasin pasin added P1: high bug labels Mar 7, 2018

@djpongh djpongh added the ready label Mar 7, 2018

pasin added a commit that referenced this issue Mar 7, 2018

Fix testSelfSignedSSLFailure_SG failed on iOS 10.2
- In iOS 10.2, when the TLS handshake failed in URLSession:didReceiveChallenge:completionHandler, the read/write stream will be closed and then -streamClosedForTask:isWrite: will be called. While in iOS 11, the task will be canceled automatically.

- We have already assigned _cancelError to the handshake error but the  _cancelError got overriden in streamClosedForTask:isWrite: method. So to fix this we just need to make sure that if the _cancelError has already been assigned, we don’t set the _cancelError to ECONNRESET.

#2094

@pasin pasin closed this Mar 7, 2018

@pasin pasin removed the ready label Mar 7, 2018

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