Bug 22121 - Regression: SDK synchronization broken in XamarinVS 3.3 and 3.5 "Unable to connect to server"
Summary: Regression: SDK synchronization broken in XamarinVS 3.3 and 3.5 "Unable to co...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.3
Hardware: PC Mac OS
: High critical
Target Milestone: 3.5
Assignee: Adrian Alonso
URL:
Depends on:
Blocks:
 
Reported: 2014-08-14 14:29 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-01-05 11:21 UTC (History)
8 users (show)

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


Attachments
Logs (6.69 KB, application/zip)
2014-08-14 14:29 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


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:
Status:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-08-14 14:29:41 UTC
Created attachment 7696 [details]
Logs

Imprecise error dialog "The SDK synchronization returned with error Unknown" when clocks are out of sync.


This looks almost the same as https://bugzilla.xamarin.com/show_bug.cgi?id=20588, but it is indeed a different problem.



## Steps to reproduce

1. Set the Mac build host clock to be about 10 seconds behind the Windows machine clock.

2. Open a Xamarin.iOS project in Visual Studio to pair to the build host.

3. Select "Tools -> Options -> Xamarin -> iOS Settings -> SDK Synchronization
-> Check Now".

4. When the "Xamarin.iOS SDK Update Available" notification pops up, click it,
and select "Yes" to start the update.



## Results

### SDKUpdate.log

> [8/14/2014 2:08:01 PM] Exception caught in SdkUpdater.Loading : System.InvalidOperationException: Failed to connect to server to update the SDK. Please make sure the build host is running.
>    at Mono.IOS.SdkUpdater.MainWindow.SetUpConnection()
>    at Mono.IOS.SdkUpdater.MainWindow.Load()
> [8/14/2014 2:08:03 PM] Exception caught in SdkUpdater.Loading : System.InvalidOperationException: Invalid response received from server while updating the SDK
>    at Mono.IOS.SdkUpdater.MainWindow.<>c__DisplayClass5.<ProcessSync>b__3()



### Error dialogs

1. "Unable to connect to server."

2. "The SDK synchronization returned with error Unknown. Please try again by launching Visual Studio and running the update process again."



## Some ideas for possible improvements

A. Check for clock skew each time when connecting to the build host, and don't allow a connection unless the clocks are in sync.

or

B. It looks like clock synchronization might not be as important as it once was? If clock synchronization is only required for the SDK sync, then the check for clock skew can instead be done before starting the SDK sync.



## Version information

XamarinVS 3.3.47
Xamarin.iOS 7.2.6.28
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-14 16:11:06 UTC
Here's one more result that might be helpful.

Keep the Mac build host clock 10 seconds behind the Windows clock (make sure to disable VM time syncing and internet time syncing).


1. Downgrade to XamarinVS 3.1.228 + Xamarin.iOS 7.2.5.5.

2. Connect to the iOS Build Host.

3. Run the SDK sync. It *succeeds*.

4. Upgrade back to XamarinVS 3.3.47 + Xamarin.iOS 7.2.6.28

5. Connect to the iOS Build Host.

6. Run the SDK sync. It fails.
Comment 2 Mohit Kheterpal 2014-08-20 06:14:16 UTC
The reason of failure of sdk sync is in Bug 22024.

Hence, I am marking it as duplicate of bug 22024

*** This bug has been marked as a duplicate of bug 22024 ***
Comment 3 Mohit Kheterpal 2014-08-20 06:16:42 UTC
This issue is already fixed and you will get the fixed build soon.

Thanks
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-20 12:29:54 UTC
Reopening.

I retested today, and I can still reproduce the problem on:

### Mac
Xamarin.iOS 7.4.0.104 (Business Edition), hash: 63b403b
Mono 3.8.0 (no/62a857e)

### Windows
Xamarin   3.5.39.0 (0a92fb56e49ed9add1c78e2c881ab6d71220d50f)
Windows 8.1 64-bit (in VMWare Fusion)



Unfortunately, based on that result, I think the cause of this problem is not bug 22024.


I tentatively have another way to reproduce the problem. I think that changing my Windows VM to have 2 processors and enabling support for VT-x/EPT is sufficient to produce the problem, even if the clocks are perfectly synchronized. I'll double-check that shortly and update this report.
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-20 14:00:34 UTC
I can now confirm the second way to reproduce the problem. I get this error every time I try to sync on the VMWare Fusion VM with 2 processors + VT-x/EPT support, regardless of the clock skew.

I currently have the VM set to use 2048 MB of memory.


I'm changing the title of this bug to account for the fact that the problem is not specific to clock skew. I think we might need to increase the priority of this bug, especially if the same problem occurs on non-virtualized Windows machines.



As with the clock skew repro (comment 1), I _cannot_ reproduce this problem on XamarinVS 3.1.228 + Xamarin.iOS 7.2.5.5. So this problem is effectively a regression of bug 20588.


I repeated the steps from comment 1 twice back-to-back using the "2 processors + VT-x/EPT" repro, and saw the same results both times:

XamarinVS 3.1.228 + Xamarin.iOS 7.2.5.4
Sync SUCCEEDS

XamarinVS 3.5.39 + Xamarin.iOS 7.4.0.104
Sync FAILS
Comment 7 PJ 2014-08-22 08:53:38 UTC
Sounds like this one might be worth considering for inclusion in 3.5 then? Moving to the 3.5 milestone.
Comment 8 Jose Miguel Torres 2014-08-22 12:50:14 UTC
Using the following bits:

* XamarinVS 3.1.228 + Xamarin.iOS 7.2.5.4
* XamarinVS 3.5.39 + Xamarin.iOS 7.4.0.104

With:

* VMWare Fusion 5.0 (VM with 2 processors + VT-x/EPT support enabled)

I have been unable to reproduce this issue. Even using a 10 seconds back clock skew on the Mac side.

I have ran the steps described above three times and always the SDKSync took place successfully. I even tried that out on a PC instead of a VMWare instance and it ran successfully as well.

## Some highlights

* The mtbsever.log you attached to this issue states that the source of the SDK break is:

[14-Aug-2014 14:05:21] Error: /Developer/MonoTouch/usr/share/doc/MonoTouch/MDocArchiveToMsxDocConverter.exe not found

And this is related to #22024.

* I couldn't figure out the "direct" relationship between the deskcases from the comment #6 with this particular case.

* I noticed  that after downgrade¡ing/upgrade¡ing Xamarin.iOS on Mac and I leaving the Xamarin.iOS BUild Host opened, there was a connection issue when trying to pair VS -object disposed exception-.

## Need info:

* I would need a fresh mtbserver.log, just the portion in from where you upgrade the monotouch to the end.
* Let me know whether you close explicity Xamarin.iOS Build Host app when upgrades takes place.

Thanks!!!
Comment 9 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-22 13:01:10 UTC
> /Developer/MonoTouch/usr/share/doc/MonoTouch/MDocArchiveToMsxDocConverter.exe
not found
> And this is related to #22024

I agree that this is a harmless (if misleading) error message. Just for reference, I filed a bug about removing that error message here: https://bugzilla.xamarin.com/show_bug.cgi?id=21667.


> * VMWare Fusion 5.0 (VM with 2 processors + VT-x/EPT support enabled)
> I have been unable to reproduce this issue.


Ah ha. Tricky. My suspicion is it might be some kind of race condition. I'll see if I can still reproduce it right now, and add another update here with the new `mtbserver.log`.
Comment 10 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-22 13:07:34 UTC
> * I noticed  that after downgrade¡ing/upgrade¡ing Xamarin.iOS on Mac and I
> leaving the Xamarin.iOS BUild Host opened, there was a connection issue when
> trying to pair VS -object disposed exception-.

Again just for reference, I've filed a bug about that issue too:
https://bugzilla.xamarin.com/show_bug.cgi?id=21654
Comment 11 Adrian Alonso 2014-08-22 13:12:57 UTC
I can reproduce the issue on my machine. So taking a look at it right now...
Comment 13 Mohit Kheterpal 2014-08-25 12:57:49 UTC
I have checked this issue and unable to reproduce this issue with X.iOS 7.2.6.104 + XVS 3.5.39. I am able to sync SDK successfully with VMware also.

So, Brendan, could you please verify this issue with fixed build if possible ?

Thanks.
Comment 14 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-25 14:42:29 UTC
Thanks for checking on this Mohit.

I can indeed verify that this is fixed on my machine on Xamarin 3.5.49.


I retested both the clock skew repro and the 2 processors repro today:


XamarinVS 3.5.39 + Xamarin.iOS 7.4.0.104
Sync FAILS


XamarinVS 3.5.49 + Xamarin.iOS 7.4.0.104
Sync SUCCEEDS



Thanks again for the fix!
Comment 15 Mohit Kheterpal 2014-08-25 14:50:28 UTC
Thanks Bredan!

As per comment 14, this issue is working fine now.

Hence closing this issue via changing its status Verified.