Repository navigation
Closed
Labels
area-System.Net.Quicdisabled-testThe test is disabled in source code against the issuein-prThere is an active PR which will close this issue when it is merged
Milestone
Description
System.Net.Quic.Tests.MsQuicTests.CertificateCallbackThrowPropagates [FAIL]
Assert.Throws() Failure: Exception type was not an exact match
Expected: typeof(System.Security.Authentication.AuthenticationException)
Actual: typeof(System.Net.Quic.QuicException)
---- System.Net.Quic.QuicException : Connection handshake was canceled due to the configured timeout of 00:00:10 seconds elapsing.
-------- System.OperationCanceledException : The operation was canceled.
Stack Trace:
/_/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs(390,0): at System.Net.Quic.Tests.MsQuicTests.CertificateCallbackThrowPropagates()
/_/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs(397,0): at System.Net.Quic.Tests.MsQuicTests.CertificateCallbackThrowPropagates()
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
/_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs(294,0): at System.Net.Quic.QuicListener.StartConnectionHandshake(QuicConnection connection, SslClientHelloInfo clientHello)
/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs(264,0): at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs(372,0): at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
/_/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs(913,0): at System.Threading.ThreadPoolWorkQueue.Dispatch()
/_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.NonBrowser.cs(102,0): at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
--- End of stack trace from previous location ---
/_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs(186,0): at System.Net.Quic.QuicListener.AcceptConnectionAsync(CancellationToken cancellationToken)
/_/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs(390,0): at System.Net.Quic.Tests.MsQuicTests.<>c__DisplayClass8_0.<<CertificateCallbackThrowPropagates>b__2>d.MoveNext()
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
/_/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/ValueTaskSource.cs(119,0): at System.Net.Quic.ValueTaskSource.TryComplete(Exception exception)
/_/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs(1203,0): at System.Threading.CancellationTokenSource.CallbackNode.ExecuteCallback()
/_/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs(810,0): at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
/_/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs(696,0): at System.Threading.CancellationTokenSource.NotifyCancellation(Boolean throwOnFirstException)
/_/src/libraries/System.Private.CoreLib/src/System/Threading/Timer.cs(683,0): at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
/_/src/libraries/System.Private.CoreLib/src/System/Threading/Timer.cs(331,0): at System.Threading.TimerQueue.FireNextTimers()
/_/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs(913,0): at System.Threading.ThreadPoolWorkQueue.Dispatch()
/_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.NonBrowser.cs(102,0): at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
--- End of stack trace from previous location ---
/_/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/ValueTaskSource.cs(176,0): at System.Net.Quic.ValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
/_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs(241,0): at System.Net.Quic.QuicListener.StartConnectionHandshake(QuicConnection connection, SslClientHelloInfo clientHello)
Output:
System.Net.Quic.QuicException: User configured callback failed.
---> System.ArithmeticException: foobar
at System.Net.Quic.Tests.MsQuicTests.<>c__DisplayClass8_0.<CertificateCallbackThrowPropagates>b__1(Object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors) in /_/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs:line 383
at System.Net.Quic.QuicConnection.SslConnectionOptions.ValidateCertificate(X509Certificate2 certificate, Span`1 certData, Span`1 chainData) in /_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.SslConnectionOptions.cs:line 225
--- End of inner exception stack trace ---
at System.Net.Quic.QuicConnection.SslConnectionOptions.ValidateCertificate(X509Certificate2 certificate, Span`1 certData, Span`1 chainData) in /_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.SslConnectionOptions.cs:line 252
at System.Net.Quic.QuicConnection.SslConnectionOptions.ValidateCertificate(X509Certificate2 certificate, Span`1 certData, Span`1 chainData) in /_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.SslConnectionOptions.cs:line 225
at System.Net.Quic.QuicConnection.SslConnectionOptions.StartAsyncCertificateValidation(IntPtr certificatePtr, IntPtr chainPtr)
at System.Net.Quic.ValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) in /_/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/ValueTaskSource.cs:line 176
at System.Net.Quic.QuicConnection.FinishConnectAsync(QuicClientConnectionOptions options, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs:line 365
at System.Net.Quic.QuicConnection.<ConnectAsync>g__StartConnectAsync|2_0(QuicClientConnectionOptions options, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs:line 79
at System.Net.Quic.QuicConnection.<ConnectAsync>g__StartConnectAsync|2_0(QuicClientConnectionOptions options, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs:line 94
at System.Net.Quic.Tests.MsQuicTests.<>c__DisplayClass8_0.<<CertificateCallbackThrowPropagates>b__3>d.MoveNext() in /_/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs:line 388
--- End of stack trace from previous location ---
at Xunit.Assert.RecordExceptionAsync(Func`1 testCode) in /_/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 105
MsQuic Counters:
CONN_CREATED 1577
CONN_HANDSHAKE_FAIL 25
CONN_APP_REJECT 8
CONN_LOAD_REJECT 0
Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=583082
Build error leg or test failing: System.Net.Quic.Tests.MsQuicTests.CertificateCallbackThrowPropagates
Pull request: #99033
Error Message
Fill the error message using step by step known issues guidance.
{
"ErrorMessage": "System.Net.Quic.QuicException : Connection handshake was canceled due to the configured timeout of 00:00:10 seconds elapsing.",
"ErrorPattern": "",
"BuildRetry": false,
"ExcludeConsoleLog": false
}Known issue validation
Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=583082
Error message validated: [System.Net.Quic.QuicException : Connection handshake was canceled due to the configured timeout of 00:00:10 seconds elapsing.]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 2/28/2024 7:50:19 PM UTC
Report
Summary
| 24-Hour Hit Count | 7-Day Hit Count | 1-Month Count |
|---|---|---|
| 24 | 24 | 24 |
Metadata
Metadata
Assignees
Labels
area-System.Net.Quicdisabled-testThe test is disabled in source code against the issuein-prThere is an active PR which will close this issue when it is merged
Activity
ManickaP commentedon Feb 29, 2024
@rzikm do you think this might be related to your recent change in cert validation?
rzikm commentedon Feb 29, 2024
It is possible let me have a look
rzikm commentedon Feb 29, 2024
Investigation notes:
The failures seem to be concentrated on Alpine images which have MsQuic built from main, according to the commit hash of the libversion, the msquic library version should contain all the necessary changes for the feature to work.
Still curious why this failure didn't show up on the original PR
ManickaP commentedon Feb 29, 2024
It's likely it didn't run on that set up at all. From our perspective, successful run of the test vs didn't run at all is really almost impossible to distinguish.
rzikm commentedon Feb 29, 2024
Looks like microsoft/msquic#4145 was not enough, We will have to disable the test for now, as this will take some time to fix.
rzikm commentedon Feb 29, 2024
I think I figured out what is happening, and it's more complicated than I thought. According to the traces and packet captures I collected, following happens around the certificate validation
_connectedTcsruntime/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.SslConnectionOptions.cs
Lines 138 to 141 in 56af107
runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.SslConnectionOptions.cs
Lines 159 to 162 in 56af107
_connectedTcs.runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs
Line 79 in 56af107
ManickaP commentedon Feb 29, 2024
@rzikm Could you also similarly describe what the problem is and how it manifests (not just the root cause)?
rzikm commentedon Feb 29, 2024
One way to look at it saying this is a data race between
ConnectionCertificateValidationCompleteandConnectionShutdownwhen called in a quick succession (due to how MsQuic queues the operations, this is a race even if we call them from the same thread in .NET)ManickaP commentedon Feb 29, 2024
I understand this, I was more interested in how this translates to Handshake timeout on the other side.
1 remaining item
rzikm commentedon Jun 20, 2024
This issue will be resolved in 2.4 release of MsQuic.
liveans commentedon Aug 11, 2024
This issue is fixed with msquic 2.4 release but looks like we're still disabling this test against msquic versions which is lower than 2.4 with
ActiveIssueattribute and if we want to close the issue we should delete that attribute and deletedisabled testlabel on issue, I think we should decide about what to do with it.ActiveIssueattribute toVersion check logic inside codeand let it run on all test suite and close this issue.featurewith msquic versions which is higher than 2.4I believe we can do the first option for the short term, but second option might be more reliable option here (has some perf downsides).
I think we were going to discuss it, right? @rzikm
Also deleting
tracking-external-issuebecause action is on our side now.rzikm commentedon Aug 12, 2024
Last time I mentioned it in the team the feeling was to guarantee correct behavior even at cost of some perf.
Since MsQuic 2.4.1+ is available, I don't expect bumping the required version for the feature is going to adversely affect anyone.