Bug 59900 - [intermittent] SetUp : System.Net.Http.HttpRequestException : An error occurred while sending the request
Summary: [intermittent] SetUp : System.Net.Http.HttpRequestException : An error occurr...
Status: RESOLVED ANSWERED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Test Cloud (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-10-02 15:32 UTC by Peter Simons
Modified: 2017-10-30 23:03 UTC (History)
6 users (show)

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

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:
RESOLVED ANSWERED

Description Peter Simons 2017-10-02 15:32:52 UTC
When running our UITests for android we intermittently get the following error. its a different test and we have 4 build machines running the tests and they have all reported this failure at one point or another. we always get at least 1 of our tests fail for this reason on every run so we see it 1/50 times but this means that we never have a clean run of tests even if they are all ok.

The error:

SetUp : System.Net.Http.HttpRequestException : An error occurred while sending the request
----> System.IO.IOException : Error writing request
----> System.Net.Sockets.SocketException : The socket has been shut down


Stack Trace:

at System.Net.Http.HttpClientHandler+<SendAsync>d__63.MoveNext () [0x004bc] in <f271ceab802a4aac8aaf711c957f04ad>:0
--- End of stack trace from previous location where exception was thrown ---
at Xamarin.UITest.Shared.Http.HttpClient.SendData (System.String endpoint, System.String method, System.Net.Http.HttpContent content, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy, System.Nullable`1[T] timeOut) [0x000ea] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Http.HttpClient.Post (System.String endpoint, System.String arguments, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy, System.Nullable`1[T] timeOut) [0x00017] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Http.HttpClient.PostUntilExpectedResultReceived (System.String endpoint, System.String arguments, System.String expectedContent, System.Int32 retries) [0x000d2] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Android.HttpApplicationStarter.Execute (System.String intentJson) [0x00000] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.LaunchApp (System.String appPackageName, Xamarin.UITest.Shared.Android.ApkFile testServerApkFile, System.Int32 testServerPort) [0x000a4] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.LaunchApp (Xamarin.UITest.Shared.Android.ApkFile appApkFile, Xamarin.UITest.Shared.Android.ApkFile testServerApkFile, System.Int32 testServerPort) [0x00007] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Android.AndroidApp..ctor (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration, Xamarin.UITest.Shared.Execution.IExecutor executor) [0x001c1] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Android.AndroidApp..ctor (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration) [0x00000] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <e3fbae5611374d67b847056913ae6e0a>:0
at Central.Automation.AppInitializer.StartApp (Xamarin.UITest.Platform platform, System.Boolean commandLine, System.String appFilename) [0x0004e] in <e7aa8a122a954acebe0845d7902b2070>:0
at FreeTrade.UITest.BaseTests.BeforeEachTest () [0x00005] in <e7aa8a122a954acebe0845d7902b2070>:0
--IOException
at System.Net.WebConnectionStream.EndWrite (System.IAsyncResult r) [0x000b8] in <70507a44a84041d599bbfa8f3d0ea5b1>:0
at System.IO.Stream+<>c.<BeginEndWriteAsync>b__53_1 (System.IO.Stream stream, System.IAsyncResult asyncResult) [0x00000] in <48b95f3df5804531818f80e28ec60191>:0
at (wrapper delegate-invoke) System.Func`3[System.IO.Stream,System.IAsyncResult,System.Threading.Tasks.VoidTaskResult]:invoke_TResult_T1_T2 (System.IO.Stream,System.IAsyncResult)
at System.Threading.Tasks.TaskFactory`1+FromAsyncTrimPromise`1[TResult,TInstance].Complete (TInstance thisRef, System.Func`3[T1,T2,TResult] endMethod, System.IAsyncResult asyncResult, System.Boolean requiresSynchronization) [0x00000] in <48b95f3df5804531818f80e28ec60191>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <48b95f3df5804531818f80e28ec60191>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <48b95f3df5804531818f80e28ec60191>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <48b95f3df5804531818f80e28ec60191>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <48b95f3df5804531818f80e28ec60191>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <48b95f3df5804531818f80e28ec60191>:0
at System.Net.Http.HttpClientHandler+<SendAsync>d__63


Another Stack Trace from a different build machine:

at System.Net.Http.HttpClientHandler+<SendAsync>d__63.MoveNext () [0x004bc] in <f271ceab802a4aac8aaf711c957f04ad>:0
--- End of stack trace from previous location where exception was thrown ---
at Xamarin.UITest.Shared.Http.HttpClient.SendData (System.String endpoint, System.String method, System.Net.Http.HttpContent content, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy, System.Nullable`1[T] timeOut) [0x000ea] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Http.HttpClient.Post (System.String endpoint, System.String arguments, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy, System.Nullable`1[T] timeOut) [0x00017] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Http.HttpClient.PostUntilExpectedResultReceived (System.String endpoint, System.String arguments, System.String expectedContent, System.Int32 retries) [0x000d2] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Android.HttpApplicationStarter.Execute (System.String intentJson) [0x00000] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.LaunchApp (System.String appPackageName, Xamarin.UITest.Shared.Android.ApkFile testServerApkFile, System.Int32 testServerPort) [0x000a4] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.LaunchApp (Xamarin.UITest.Shared.Android.ApkFile appApkFile, Xamarin.UITest.Shared.Android.ApkFile testServerApkFile, System.Int32 testServerPort) [0x00007] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Android.AndroidApp..ctor (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration, Xamarin.UITest.Shared.Execution.IExecutor executor) [0x001c1] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Android.AndroidApp..ctor (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration) [0x00000] in <e3fbae5611374d67b847056913ae6e0a>:0
at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <e3fbae5611374d67b847056913ae6e0a>:0
at Central.Automation.AppInitializer.StartApp (Xamarin.UITest.Platform platform, System.Boolean commandLine, System.String appFilename) [0x0004e] in <a3c6dcd04326499db9c81fc0d67f19d0>:0
at FreeTrade.UITest.BaseTests.BeforeEachTest () [0x00005] in <a3c6dcd04326499db9c81fc0d67f19d0>:0
--IOException
at System.Net.WebConnectionStream.EndWrite (System.IAsyncResult r) [0x000b8] in <70507a44a84041d599bbfa8f3d0ea5b1>:0
at System.IO.Stream+<>c.<BeginEndWriteAsync>b__53_1 (System.IO.Stream stream, System.IAsyncResult asyncResult) [0x00000] in <48b95f3df5804531818f80e28ec60191>:0
at (wrapper delegate-invoke) System.Func`3[System.IO.Stream,System.IAsyncResult,System.Threading.Tasks.VoidTaskResult]:invoke_TResult_T1_T2 (System.IO.Stream,System.IAsyncResult)
at System.Threading.Tasks.TaskFactory`1+FromAsyncTrimPromise`1[TResult,TInstance].Complete (TInstance thisRef, System.Func`3[T1,T2,TResult] endMethod, System.IAsyncResult asyncResult, System.Boolean requiresSynchronization) [0x00000] in <48b95f3df5804531818f80e28ec60191>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <48b95f3df5804531818f80e28ec60191>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <48b95f3df5804531818f80e28ec60191>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <48b95f3df5804531818f80e28ec60191>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <48b95f3df5804531818f80e28ec60191>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <48b95f3df5804531818f80e28ec60191>:0
at System.Net.Http.HttpClientHandler+<SendAsync>d__63

I believe this problem to be related to this post on the xamarin forum: https://forums.xamarin.com/discussion/99858/xamarin-uitest-error-setup-an-error-occurred-while-sending-the-request-android
Comment 1 Pierce Boggan [MSFT] 2017-10-03 16:22:47 UTC
Hi Peter,

Thanks so much for taking the time to file this issue! :) The Test Cloud / UITest team tracks their issues in a separate bug management system, so unfortunately I couldn't transfer this ticket to that category.

The recommended way of filing issues is through the Test Cloud support channels - mainly because there is a lot of crossover between the testing platform and testing frameworks.

You can reach out to support by logging into testcloud.xamarin.com & clicking on “Support” in the menubar: http://content.screencast.com/users/Kent.Green/folders/Jing/media/572442e2-c82c-4a25-9a30-1f594f156dd7/00000323.png

Thanks,
Pierce Boggan
Comment 2 Peter Simons 2017-10-03 16:26:22 UTC
Hi were not actually using test cloud, we're running our tests locally i logged it under test cloud because there was no option to just log it under Xamarin.UITest.
Comment 3 Peter Simons 2017-10-03 16:31:50 UTC
In order to log a bug with uitest do i need to be a paying member of test cloud? how else do i get to that support option without logging in to test cloud?
Comment 4 Kent Green [MSFT] 2017-10-03 16:42:43 UTC
Hi Peter,

At this time you do not need to be a paying member of Test Cloud to report a bug through the testcloud.xamarin.com website; and even though you are only seeing the issue locally it is still the appropriate location to report the issue as Pierce noted; because the Test Cloud support team supports Xamarin.UITest.
Comment 5 Emmanuel Huna 2017-10-30 23:03:41 UTC
I logged in at testcloud.xamarin.com, clicked on "Support" and submitted this issue.

I also referenced my original question here:

https://forums.xamarin.com/discussion/comment/304429

and this ticket.