Skip to content

SignedXmlTest.VerifyXmlResolver sometimes failing due to failing to connect to localhost. #74115

Open
@danmoseley

Description

@danmoseley

This was just introduced in #73676 and is failing at least 4 times a day. @GrabYourPitchforks

History: https://dev.azure.com/dnceng/public/_build/results?buildId=1949830&view=ms.vss-test-web.build-test-results-tab&runId=50186248&resultId=193531&paneView=history

example https://dev.azure.com/dnceng/public/_build/results?buildId=1949830&view=ms.vss-test-web.build-test-results-tab&runId=50186248&resultId=193531&paneView=debug

System.Security.Cryptography.Xml.Tests.SignedXmlTest.VerifyXmlResolver [[Console]](https://helixre107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-74094-merge-bd71821e4e9c4ed7aa/System.Security.Cryptography.Xml.Tests/1/console.5d095986.log?helixlogtype=result) [[Details]](https://dev.azure.com/dnceng//public/_build/results?buildId=1949830&view=ms.vss-test-web.build-test-results-tab&runId=50186248&resultId=193531&paneView=debug) [[Artifacts]](https://dev.azure.com/dnceng//public/_build/results?buildId=1949830&view=ms.vss-test-web.build-test-results-tab&runId=50186248&resultId=193531&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab) [[3.18% failure rate]](https://dev.azure.com/dnceng//public/_build/results?buildId=1949830&view=ms.vss-test-web.build-test-results-tab&runId=50186248&resultId=193531&paneView=history)
Data Driven SubResults
❌ System.Security.Cryptography.Xml.Tests.SignedXmlTest.VerifyXmlResolver(provideResolver: True)
Exception Message
System.Xml.XmlException : An error has occurred while opening external entity 'http://127.0.0.1:9000/': The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---- System.Threading.Tasks.TaskCanceledException : The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
-------- System.TimeoutException : The operation was canceled.
------------ System.Threading.Tasks.TaskCanceledException : The operation was canceled.
---------------- System.IO.IOException : Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
-------------------- System.Net.Sockets.SocketException : The I/O operation has been aborted because of either a thread exit or an application request.
Stack Trace
   at System.Xml.XmlTextReaderImpl.Throw(Exception e) in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 2778
   at System.Xml.XmlTextReaderImpl.PushExternalEntityOrSubset(String publicId, String systemId, Uri baseUri, String entityName) in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 7984
   at System.Xml.XmlTextReaderImpl.PushExternalEntity(IDtdEntityInfo entity) in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 8052
   at System.Xml.XmlTextReaderImpl.HandleGeneralEntityReference(String name, Boolean isInAttributeValue, Boolean pushFakeEntityIfNullResolver, Int32 entityStartLinePos) in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 6144
   at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos) in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 6069
   at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars) in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 5690
   at System.Xml.XmlTextReaderImpl.FinishPartialValue() in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 5834
   at System.Xml.XmlTextReaderImpl.get_Value() in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 919
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) in /_/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlLoader.cs:line 174
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) in /_/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlLoader.cs:line 60
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) in /_/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlLoader.cs:line 51
   at System.Xml.XmlDocument.Load(XmlReader reader) in /_/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlDocument.cs:line 1323
   at System.Security.Cryptography.Xml.Utils.PreProcessDocumentInput(XmlDocument document, XmlResolver xmlResolver, String baseUri) in /_/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs:line 222
   at System.Security.Cryptography.Xml.Reference.CalculateHashValue(XmlDocument document, CanonicalXmlNodeList refList) in /_/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Reference.cs:line 386
   at System.Security.Cryptography.Xml.SignedXml.CheckDigestedReferences() in /_/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXml.cs:line 917
   at System.Security.Cryptography.Xml.SignedXml.CheckSignature(KeyedHashAlgorithm macAlg) in /_/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXml.cs:line 312
   at System.Security.Cryptography.Xml.Tests.SignedXmlTest.VerifyXmlResolver(Boolean provideResolver) in /_/src/libraries/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs:line 1658
   at InvokeStub_SignedXmlTest.VerifyXmlResolver(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
----- Inner Stack Trace -----
   at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 632
   at System.Net.Http.HttpClient.GetStreamAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 352
   at System.Xml.XmlDownloadManager.GetNonFileStreamAsync(Uri uri, ICredentials credentials, IWebProxy proxy) in /_/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs:line 43
   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy) in /_/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManager.cs:line 22
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) in /_/src/libraries/System.Private.Xml/src/System/Xml/XmlUrlResolver.cs:line 47
   at System.Xml.XmlTextReaderImpl.OpenAndPush(Uri uri) in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 8023
   at System.Xml.XmlTextReaderImpl.PushExternalEntityOrSubset(String publicId, String systemId, Uri baseUri, String entityName) in /_/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs:line 7969
----- Inner Stack Trace -----
----- Inner Stack Trace -----

at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:line 836

at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:line 1091

at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs:line 30

at System.Net.Http.HttpClient.GetStreamAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 343

----- Inner Stack Trace -----

at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs:line 1451

at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs:line 1346

at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:line 1676

at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:line 599

----- Inner Stack Trace -----


Failing Configuration
net7.0-windows-Release-x86-CoreCLR_release-Windows.7.Amd64.Open

HttpListener was successfully started on 127.0.0.1:9000, but apparently did not respond promptly. That was on Windows. Looking at history, we also see failures on Android and Ubuntu, which may have a slightly different error:

                   Starting:    System.Security.Cryptography.Xml.Tests (parallel test collections = on, max threads = 1)
                       System.Xml.XmlException : An error has occurred while opening external entity 'http://127.0.0.1:9000/': The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
                       ---- System.Threading.Tasks.TaskCanceledException : The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
                       -------- System.TimeoutException : The operation was canceled.
                       ------------ System.Threading.Tasks.TaskCanceledException : The operation was canceled.
                       ---------------- System.IO.IOException : The response ended prematurely.

It's probably significant that this is not OS specific. @dotnet/ncl do you see anything obvious about the test here? Code:

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions