Skip to content
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

[libraries][tvOS] Update Issue causing System.Net.Requests to fail #56624

Merged

Conversation

mdh1418
Copy link
Member

@mdh1418 mdh1418 commented Jul 30, 2021

It was confirmed that System.Net.Requests no longer fails for System.IO.DirectoryNotFoundException.
However, the tests still crash due to an assert error with System.Net.Http.AuthenticationHelper.SendWithAuthAsync.

By not defaulting preauthenticate parameter in SendWithRequestAuthAsync call in InnerSendAsync of AuthenticationHelper.NtAuth.tvOS.cs to true, the assert error no longer crashes tests.

Fixes #56621

Instead, now there are failures with regards to

System.Net.Requests.Tests.dll   Failed: 8

Test collection for System.Net.Tests.HttpWebRequestTest_Sync
System.Net.Tests.HttpWebRequestTest_Sync.HaveResponse_GetResponseAsync_ExpectTrue(useSsl: True)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (The operation has timed out.)) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (The operation has timed out.)\n-------- System.Net.WebException : The operation has timed out.\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Sync.HaveResponse_GetResponseAsync_ExpectTrue(useSsl: False)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (Operation timed out [::ffff:127.0.0.1]:50415 (127.0.0.1:50415))) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (Operation timed out [::ffff:127.0.0.1]:50415 (127.0.0.1:50415))\n-------- System.Net.WebException : Operation timed out [::ffff:127.0.0.1]:50415 (127.0.0.1:50415)\n------------ System.Net.Http.HttpRequestException : Operation timed out [::ffff:127.0.0.1]:50415 (127.0.0.1:50415)\n---------------- System.Net.Internals.SocketExceptionFactory+ExtendedSocketException : Operation timed out [::ffff:127.0.0.1]:50415\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Sync.GetResponseAsync_UseDefaultCredentials_ExpectSuccess(useSsl: True)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (The operation has timed out.)) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (The operation has timed out.)\n-------- System.Net.WebException : The operation has timed out.\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Sync.GetResponseAsync_UseDefaultCredentials_ExpectSuccess(useSsl: False)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (Operation timed out [::ffff:127.0.0.1]:50515 (127.0.0.1:50515))) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (Operation timed out [::ffff:127.0.0.1]:50515 (127.0.0.1:50515))\n-------- System.Net.WebException : Operation timed out [::ffff:127.0.0.1]:50515 (127.0.0.1:50515)\n------------ System.Net.Http.HttpRequestException : Operation timed out [::ffff:127.0.0.1]:50515 (127.0.0.1:50515)\n---------------- System.Net.Internals.SocketExceptionFactory+ExtendedSocketException : Operation timed out [::ffff:127.0.0.1]:50515\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header

Test collection for System.Net.Tests.HttpWebRequestTest_Async
System.Net.Tests.HttpWebRequestTest_Async.GetResponseAsync_UseDefaultCredentials_ExpectSuccess(useSsl: True)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (The operation has timed out.)) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (The operation has timed out.)\n-------- System.Net.WebException : The operation has timed out.\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Async.GetResponseAsync_UseDefaultCredentials_ExpectSuccess(useSsl: False)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (Operation timed out (127.0.0.1:50645))) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (Operation timed out (127.0.0.1:50645))\n-------- System.Net.WebException : Operation timed out (127.0.0.1:50645)\n------------ System.Net.Http.HttpRequestException : Operation timed out (127.0.0.1:50645)\n---------------- System.Net.Sockets.SocketException : Operation timed out\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Async.HaveResponse_GetResponseAsync_ExpectTrue(useSsl: True)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (The operation has timed out.)) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (The operation has timed out.)\n-------- System.Net.WebException : The operation has timed out.\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Async.HaveResponse_GetResponseAsync_ExpectTrue(useSsl: False)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (Operation timed out (127.0.0.1:50739))) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (Operation timed out (127.0.0.1:50739))\n-------- System.Net.WebException : Operation timed out (127.0.0.1:50739)\n------------ System.Net.Http.HttpRequestException : Operation timed out (127.0.0.1:50739)\n---------------- System.Net.Sockets.SocketException : Operation timed out\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header

This PR does the following:
Modifies the default authentication parameters in AuthenticationHelper.NtAuth.tvOS.cs
Removes the test suite project level skip
Adds active issues to the two failing tests for tvOS #56798
Conditions two tests that fail for BinaryFormatter not supported reasons.

@filipnavara
Copy link
Member

However, the tests still crash due to an assert error with System.Net.Http.AuthenticationHelper.SendWithAuthAsync.

Do you have link to the failed test run? Is it happening on both iOS and tvOS, or only on tvOS? (the code path is different due to lack of NT authentication on tvOS)

@mdh1418
Copy link
Member Author

mdh1418 commented Jul 30, 2021

It was ran locally and crashed #56621
It was only happening on tvOS it seems. I just ran iOS and will update this and the issue accordingly. iOS only fails with binary formatter PNSE which I think I will address in another PR.

@mdh1418 mdh1418 changed the title [libraries][iOS][tvOS] Update Issue causing System.Net.Requests to fail [libraries][tvOS] Update Issue causing System.Net.Requests to fail Jul 30, 2021
@filipnavara
Copy link
Member

That seems to be a genuine bug on these lines:

SendWithProxyAuthAsync(request, authUri, async, credentials, true, connectionPool, cancellationToken).AsTask() :
SendWithRequestAuthAsync(request, async, credentials, true, connectionPool, cancellationToken).AsTask();

The preauthenticate parameter should be false instead of true. It may need some further tweaking but always sending true is definitely wrong.

@mdh1418
Copy link
Member Author

mdh1418 commented Aug 3, 2021

Re:

System.Net.Requests.Tests.dll   Failed: 8

Test collection for System.Net.Tests.HttpWebRequestTest_Sync
System.Net.Tests.HttpWebRequestTest_Sync.HaveResponse_GetResponseAsync_ExpectTrue(useSsl: True)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (The operation has timed out.)) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (The operation has timed out.)\n-------- System.Net.WebException : The operation has timed out.\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Sync.HaveResponse_GetResponseAsync_ExpectTrue(useSsl: False)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (Operation timed out [::ffff:127.0.0.1]:50415 (127.0.0.1:50415))) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (Operation timed out [::ffff:127.0.0.1]:50415 (127.0.0.1:50415))\n-------- System.Net.WebException : Operation timed out [::ffff:127.0.0.1]:50415 (127.0.0.1:50415)\n------------ System.Net.Http.HttpRequestException : Operation timed out [::ffff:127.0.0.1]:50415 (127.0.0.1:50415)\n---------------- System.Net.Internals.SocketExceptionFactory+ExtendedSocketException : Operation timed out [::ffff:127.0.0.1]:50415\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Sync.GetResponseAsync_UseDefaultCredentials_ExpectSuccess(useSsl: True)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (The operation has timed out.)) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (The operation has timed out.)\n-------- System.Net.WebException : The operation has timed out.\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Sync.GetResponseAsync_UseDefaultCredentials_ExpectSuccess(useSsl: False)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (Operation timed out [::ffff:127.0.0.1]:50515 (127.0.0.1:50515))) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (Operation timed out [::ffff:127.0.0.1]:50515 (127.0.0.1:50515))\n-------- System.Net.WebException : Operation timed out [::ffff:127.0.0.1]:50515 (127.0.0.1:50515)\n------------ System.Net.Http.HttpRequestException : Operation timed out [::ffff:127.0.0.1]:50515 (127.0.0.1:50515)\n---------------- System.Net.Internals.SocketExceptionFactory+ExtendedSocketException : Operation timed out [::ffff:127.0.0.1]:50515\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header

Test collection for System.Net.Tests.HttpWebRequestTest_Async
System.Net.Tests.HttpWebRequestTest_Async.GetResponseAsync_UseDefaultCredentials_ExpectSuccess(useSsl: True)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (The operation has timed out.)) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (The operation has timed out.)\n-------- System.Net.WebException : The operation has timed out.\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Async.GetResponseAsync_UseDefaultCredentials_ExpectSuccess(useSsl: False)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (Operation timed out (127.0.0.1:50645))) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (Operation timed out (127.0.0.1:50645))\n-------- System.Net.WebException : Operation timed out (127.0.0.1:50645)\n------------ System.Net.Http.HttpRequestException : Operation timed out (127.0.0.1:50645)\n---------------- System.Net.Sockets.SocketException : Operation timed out\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Async.HaveResponse_GetResponseAsync_ExpectTrue(useSsl: True)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (The operation has timed out.)) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (The operation has timed out.)\n-------- System.Net.WebException : The operation has timed out.\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header
System.Net.Tests.HttpWebRequestTest_Async.HaveResponse_GetResponseAsync_ExpectTrue(useSsl: False)
    System.AggregateException : One or more errors occurred. (One or more errors occurred. (Operation timed out (127.0.0.1:50739))) (One or more errors occurred. (Unexpected EOF trying to read request header))\n---- System.AggregateException : One or more errors occurred. (Operation timed out (127.0.0.1:50739))\n-------- System.Net.WebException : Operation timed out (127.0.0.1:50739)\n------------ System.Net.Http.HttpRequestException : Operation timed out (127.0.0.1:50739)\n---------------- System.Net.Sockets.SocketException : Operation timed out\n---- System.AggregateException : One or more errors occurred. (Unexpected EOF trying to read request header)\n-------- System.IO.IOException : Unexpected EOF trying to read request header

I'm not sure where tvOS and iOS are differing since the iOS tests pass.
From the stack trace, it looks like

at System.Threading.Tasks.TaskTimeoutExtensions.WhenAllOrAnyFailed(Task[] tasks) in System.Net.Requests.Tests.dll:token 0x6000065+0x247
   at System.Net.Test.Common.LoopbackServer.<>c__DisplayClass15_0.<<CreateClientAndServerAsync>b__0>d.MoveNext() in System.Net.Requests.Tests.dll:token 0x60005e7+0xc4
--- End of stack trace from previous location ---
   at System.Net.Test.Common.LoopbackServer.CreateServerAsync(Func`2 funcAsync, Options options) in System.Net.Requests.Tests.dll:token 0x6000079+0x104
   at System.Net.Tests.HttpWebRequestTest.HaveResponse_GetResponseAsync_ExpectTrue(Boolean useSsl) in System.Net.Requests.Tests.dll:token 0x6000146+0xb4
--- End of stack trace from previous location ---
----- Inner Stack Trace #1 (System.AggregateException) -----
----- Inner Stack Trace -----
   at System.Net.HttpWebRequest.GetResponse() in System.Net.Requests.dll:token 0x6000124+0x2c
   at System.Net.Tests.HttpWebRequestTest_Sync.<>c__DisplayClass1_0.<GetResponseAsync>b__0() in System.Net.Requests.Tests.dll:token 0x60002c1+0x0
   at System.Threading.Tasks.Task`1[[System.Net.WebResponse, System.Net.Requests, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].InnerInvoke() in System.Private.CoreLib.dll:token 0x60033a3+0x25
   at System.Threading.Tasks.Task.<>c.<.cctor>b__271_0(Object obj) in System.Private.CoreLib.dll:token 0x6003544+0x16
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) in System.Private.CoreLib.dll:token 0x6003002+0x36
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) in System.Private.CoreLib.dll:token 0x6003002+0x79
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) in System.Private.CoreLib.dll:token 0x600349e+0xd3
--- End of stack trace from previous location ---
   at System.Net.Tests.HttpWebRequestTest.<HaveResponse_GetResponseAsync_ExpectTrue>b__118_0(Uri uri) in System.Net.Requests.Tests.dll:token 0x6000170+0xbe
   at System.Threading.Tasks.TaskTimeoutExtensions.WhenAllOrAnyFailed(Task[] tasks) in System.Net.Requests.Tests.dll:token 0x6000065+0x13e
----- Inner Stack Trace #2 (System.AggregateException) -----
----- Inner Stack Trace -----
   at System.Net.Test.Common.LoopbackServer.Connection.ReadRequestHeaderBytesAsync() in System.Net.Requests.Tests.dll:token 0x600026c+0xf0
   at System.Net.Test.Common.LoopbackServer.Connection.ReadRequestDataAsync(Boolean readBody) in System.Net.Requests.Tests.dll:token 0x6000274+0x8c
   at System.Net.Test.Common.LoopbackServer.Connection.HandleRequestAsync(HttpStatusCode statusCode, IList`1 headers, String content) in System.Net.Requests.Tests.dll:token 0x600027d+0x82
   at System.Net.Test.Common.LoopbackServer.HandleRequestAsync(HttpStatusCode statusCode, IList`1 headers, String content) in System.Net.Requests.Tests.dll:token 0x600008c+0x125
   at System.Threading.Tasks.TaskTimeoutExtensions.WhenAllOrAnyFailed(Task[] tasks) in System.Net.Requests.Tests.dll:token 0x6000065+0x90

So ReadLineBytesAsync is called by ReadRequestHeaderBytesAsync and there must be something going wrong with reading the bytes

@mdh1418 mdh1418 merged commit 7a4aa2e into dotnet:main Aug 6, 2021
@mdh1418 mdh1418 deleted the ios_tvos_system_net_requests_migrate_issue branch August 6, 2021 13:19
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants