Bug 60037 - Mac Agent Not Working - Connects briefly then disconnects
Summary: Mac Agent Not Working - Connects briefly then disconnects
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: XMA ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: 15.5
Assignee: Bugzilla
Depends on:
Reported: 2017-10-07 15:17 UTC by alex2_wernick
Modified: 2017-10-27 11:37 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Logs (22.32 KB, application/x-zip-compressed)
2017-10-07 15:17 UTC, alex2_wernick

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description alex2_wernick 2017-10-07 15:17:20 UTC
Created attachment 25206 [details]

Using Visual Studio Community 2017 with Windows 7
Mac is running IOS 10.13

When connecting to the MAC using the XMA the connection briefly connects then disconnects. The time the connection lasts for can vary but is generally around 15mins. Once the connection is lost reconnecting often does not work.

The relevant logs on the Windows and Mac side are attached.

I have tried the solutions found https://developer.xamarin.com/guides/ios/getting_started/installation/windows/connecting-to-mac/troubleshooting/#knownissues with no success.
Comment 1 mag@xamarin.com 2017-10-18 15:35:17 UTC
From what I can see in the logs, the disconnections are caused by the SSH session being aborted because of a socket disconnection. We can see that in both SSH log on the Mac and also on the VS log in Windows:

- Mac:

Oct  7 15:51:28 RebeccasMacBook com.apple.xpc.launchd[1] (com.openssh.sshd.F8DD9ED7-216C-425D-BE4F-350CC3D69138[6777]): 
Service exited with abnormal code: 255

Oct  7 15:55:01 RebeccasMacBook sshd: rebeccagrant [priv][4231]: DEAD_PROCESS: 4325 ttys002

Oct  7 15:55:01 RebeccasMacBook com.apple.xpc.launchd[1] (com.openssh.sshd.11598EAE-4A78-4DDE-99F7-ACB72B7CFA0E[4231]): 
Service exited with abnormal code: 255

- Windows:

Xamarin.Messaging.Ssh.SshMessagingConnection|Error|0|An unexpected error occurred with the current SSH Session
Renci.SshNet.Common.SshOperationTimeoutException: Socket read operation has timed out after -1 milliseconds.
   at Renci.SshNet.Abstractions.SocketAbstraction.Read(Socket socket, Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
   at Renci.SshNet.Session.SocketRead(Int32 length, Byte[] buffer)
   at Renci.SshNet.Session.ReceiveMessage()
   at Renci.SshNet.Session.MessageListener()

There is no single cause or solution for unexpected SSH disconnections, but they are mostly related to network glitches; which can happen in a network based or distributed application. 
What I see in this particular issue is that what affects the experience is not the unexpected disconnection itself but how we react against it. As you mentioned, the reconnection often doesn't work.

That is a problem that we identified some time ago and that we have been working on to fix and improve, together with the hole connection process itself.
That said, from the next 15.5 release we will introduce many improvements and fixes around these topics: XMA connection workflow, better user experience and UI feedback, build timeouts, reconnections experience after unexpected disconnections, etc.

With a correct reconnection mechanism, for the most of the cases you shouldn't even notice that there was a disconnection because XMA will reconnect silently and you should keep working as if nothing happens.

I'm confident that all those changes (specially the reconnection and build ones) will help in this case to "at least" reconnect fine and let you continue working without problems.

For this reason I mark this issue as Resolved and ask you to please give it a try and compare the experience from the upcoming 15.5 release.

If you still see problems or have feedback about the mentioned things, please feel free to re open this issue or open another one.