Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Testing Thali-iOS: Multiconnect resolves with port number 0. #1903

Open
lesn1kk opened this issue Jun 12, 2017 · 4 comments
Open

Testing Thali-iOS: Multiconnect resolves with port number 0. #1903

lesn1kk opened this issue Jun 12, 2017 · 4 comments
Assignees
Labels

Comments

@lesn1kk
Copy link
Member

lesn1kk commented Jun 12, 2017

It causes tests to fail because of error that this port is not available. I tried to run Can shift data via parallel connections multiple times and at some point it failed.
Logs

@enricogior
Copy link
Member

From the log, we can see that there are two different things causing this issue.

[ThaliCore] BrowserManager.connectToPeer(_:syncValue:completion:) peer:C64DDE67-6011-427C-BDC0-9E94B512EB7B
[ThaliCore] Browser.inviteToConnect(_:sessionConnected:sessionNotConnected:) Peer(uuid: "C64DDE67-6011-427C-BDC0-9E94B512EB7B", generation: 0)
[ThaliCore] Session.init(session:identifier:connected:notConnected:) peer:C64DDE67-6011-427C-BDC0-9E94B512EB7B:0
[ThaliCore] Session.session(_:peer:didChange:) peer:BD7F2AF8-F739-4D63-A46B-CB02E373FDE3:0
[ThaliCore] Session.sessionNotConnected failed to connect to peer:BD7F2AF8-F739-4D63-A46B-CB02E373FDE3
[ThaliCore] BrowserRelay.closeRelay() disconnecting:false
[ThaliCore] Session.disconnect() peer:BD7F2AF8-F739-4D63-A46B-CB02E373FDE3:0
2017-06-12 12:26:37 - DEBUG thaliMobileNativeWrapper: 'multiConnectResolved: {"syncValue":"CPHHLKlZWuMYW9Ciiz4peARRwH6qOjxl","error":"Connection could not be established","portNumber":null}'
2017-06-12 12:26:37 - DEBUG thaliMobileNativeTestUtils: 'Got multiConnectResolved -syncValue: 'CPHHLKlZWuMYW9Ciiz4peARRwH6qOjxl', error: 'Connection could not be established', listeningPort: '%s''
2017-06-12 12:26:37 - DEBUG thaliMobileNativeWrapper: 'Received peer availability changed event with {"peerIdentifier":"BD7F2AF8-F739-4D63-A46B-CB02E373FDE3","peerAvailable":false,"portNumber":null,"recreated":true}'
2017-06-12 12:26:37 - DEBUG thaliMobileNativeWrapper: 'Filtered out nonTCPPeerAvailabilityChangedEvent due to not being in started state'
2017-06-12 12:26:37 - DEBUG thaliMobileNativeWrapper: 'Received peer availability changed event with {"peerIdentifier":"BD7F2AF8-F739-4D63-A46B-CB02E373FDE3","peerAvailable":true,"portNumber":null,"recreated":true}'
2017-06-12 12:26:37 - DEBUG thaliMobileNativeWrapper: 'Filtered out nonTCPPeerAvailabilityChangedEvent due to not being in started state'
2017-06-12 12:26:37 - ERROR thaliMobileNativeTestUtils: 'Fatal connect error: 'Connection could not be established''
2017-06-12 12:26:37 - DEBUG thaliMobileNativeTestUtils: 'Issuing multiConnect for C64DDE67-6011-427C-BDC0-9E94B512EB7B (syncValue: zjAqWcagknXt2ETg9H6evvB4uUWDUymq)'
2017-06-12 12:26:37 - DEBUG thaliMobileNativeTestUtils: 'Got 'multiConnect' callback'
[ThaliCore] BrowserManager.connectToPeer(_:syncValue:completion:) peer:C64DDE67-6011-427C-BDC0-9E94B512EB7B
[ThaliCore] BrowserManager.connectToPeer(_:syncValue:completion:) found active relay
2017-06-12 12:26:37 - DEBUG thaliMobileNativeWrapper: 'multiConnectResolved: {"syncValue":"zjAqWcagknXt2ETg9H6evvB4uUWDUymq","error":null,"portNumber":0}'
2017-06-12 12:26:37 - DEBUG thaliMobileNativeTestUtils: 'Got multiConnectResolved -syncValue: 'zjAqWcagknXt2ETg9H6evvB4uUWDUymq', error: 'null', listeningPort: '0''

There is a first attempt to connect to peer C64DDE67-6011-427C-BDC0-9E94B512EB7B that fails because it's a zombie advertiser.
Then there is a second attempt to connect again to the same peer, this time instead of returning an error, ThaliCore returns a successful connection with a port number set to zero.

We need to change the test so it will not try to connect to a peer that has already returned an error.
We also need to fix ThaliCore so it will remove the BrowserRelay after a failed connection, so it will not find it in the list of active relays and return a success with a port equal to zero.
I can open a new issue to track the ThaliCore bug.

@lesn1kk
Copy link
Member Author

lesn1kk commented Jun 13, 2017

In tests we can probably filter all connections with port 0, so it won't be a problem. However, the fix for ThaliCore itself is more significant, because it could have direct impact on Thali, so this is definitely something we need to resolve.

@lesn1kk
Copy link
Member Author

lesn1kk commented Jun 13, 2017

Turned out it was an issue in tests code after latest changes and unavailable peers were not removed from array correctly.

@enricogior
Copy link
Member

The ThaliCore bug is tracked here #1906
I'm working on it.

@enricogior enricogior added the iOS label Jul 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants