diff --git a/eng/docker/build-docker-sdk.ps1 b/eng/docker/build-docker-sdk.ps1 index 1a09343defbf6..bc73312efcb6c 100755 --- a/eng/docker/build-docker-sdk.ps1 +++ b/eng/docker/build-docker-sdk.ps1 @@ -36,7 +36,6 @@ if ($buildWindowsContainers) # 2. Runtime pack (microsoft.netcore.app.runtime.win-x64) # 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK # 4. testhost - # 5. msquic interop sources (needed for HttpStress) $binArtifacts = "$REPO_ROOT_DIR\artifacts\bin" $dockerContext = "$REPO_ROOT_DIR\artifacts\docker-context" @@ -52,8 +51,6 @@ if ($buildWindowsContainers) -Destination $dockerContext\testhost Copy-Item -Recurse -Path $REPO_ROOT_DIR\eng\targetingpacks.targets ` -Destination $dockerContext\targetingpacks.targets - Copy-Item -Recurse -Path $REPO_ROOT_DIR\src\libraries\System.Net.Quic\src\System\Net\Quic\Interop ` - -Destination $dockerContext\msquic-interop # In case of non-CI builds, testhost may already contain Microsoft.AspNetCore.App (see build-local.ps1 in HttpStress): $testHostAspNetCorePath="$dockerContext\testhost\net$dotNetVersion-windows-$configuration-x64/shared/Microsoft.AspNetCore.App" diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index 401ce9f1ffd43..8d7d6169a9fe9 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -26,7 +26,6 @@ RUN bash ./dotnet-install.sh --channel $_DOTNET_INSTALL_CHANNEL --quality daily # 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) # 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK # 4. testhost -# 5. msquic interop sources (needed for HttpStress) COPY --from=corefxbuild \ /repo/artifacts/bin/microsoft.netcore.app.ref \ @@ -44,10 +43,6 @@ COPY --from=corefxbuild \ /repo/artifacts/bin/testhost \ /live-runtime-artifacts/testhost -COPY --from=corefxbuild \ - /repo/src/libraries/System.Net.Quic/src/System/Net/Quic/Interop \ - /live-runtime-artifacts/msquic-interop - # Add AspNetCore bits to testhost: ENV _ASPNETCORE_SOURCE="/usr/share/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" ENV _ASPNETCORE_DEST="/live-runtime-artifacts/testhost/net$VERSION-linux-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props index 3ee8cbfa7ae05..cca94e249c25e 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props @@ -6,7 +6,6 @@ $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)../, global.json))/ - $(RepositoryRoot)src/libraries/System.Net.Quic/src/System/Net/Quic/Interop/*.cs $(RepositoryRoot)eng/targetingpacks.targets 8.0.0 net8.0 diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile index 6dc83bce1895e..e56f8c80c3212 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile @@ -28,7 +28,6 @@ WORKDIR /app COPY . . RUN dotnet build -c $CONFIGURATION \ - -p:MsQuicInteropIncludes="/live-runtime-artifacts/msquic-interop/*.cs" \ -p:TargetingPacksTargetsLocation=/live-runtime-artifacts/targetingpacks.targets \ -p:MicrosoftNetCoreAppRefPackDir=/live-runtime-artifacts/microsoft.netcore.app.ref/ \ -p:MicrosoftNetCoreAppRuntimePackDir=/live-runtime-artifacts/microsoft.netcore.app.runtime.linux-x64/$CONFIGURATION/ diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index b98a4bd529c76..984ce233dc029 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -17,11 +17,6 @@ - - - - - false diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index 0f47ae1b232fd..19c5f9e2f45dd 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -14,7 +14,6 @@ using System.Net; using HttpStress; using System.Net.Quic; -using Microsoft.Quic; [assembly:SupportedOSPlatform("windows")] [assembly:SupportedOSPlatform("linux")] @@ -186,23 +185,6 @@ private static async Task Run(Configuration config) Console.WriteLine("Query Parameters: " + config.MaxParameters); Console.WriteLine(); - if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported) - { - unsafe - { - // If the system gets overloaded, MsQuic has a tendency to drop incoming connections, see https://github.com/dotnet/runtime/issues/55979. - // So in case we're running H/3 stress test, we're using the same hack as for System.Net.Quic tests, which increases the time limit for pending operations in MsQuic thread pool. - object msQuicApiInstance = msQuicApiType.GetProperty("Api", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); - QUIC_API_TABLE* apiTable = (QUIC_API_TABLE*)(Pointer.Unbox(msQuicApiType.GetProperty("ApiTable").GetGetMethod().Invoke(msQuicApiInstance, Array.Empty()))); - QUIC_SETTINGS settings = default(QUIC_SETTINGS); - settings.IsSet.MaxWorkerQueueDelayUs = 1; - settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default - if (MsQuic.StatusFailed(apiTable->SetParam(null, MsQuic.QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings))) - { - Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); - } - } - } StressServer? server = null; if (config.RunMode.HasFlag(RunMode.server)) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs index 76176390615a0..77e3eb87cfe10 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs @@ -32,6 +32,10 @@ public class StressClient : IDisposable public StressClient((string name, Func operation)[] clientOperations, Configuration configuration) { + _cts.Token.Register(() => + { + Console.WriteLine($"!!!Client cancellation invoked!!!"); + }); _clientOperations = clientOperations; _config = configuration; _baseAddress = new Uri(configuration.ServerUri); @@ -95,6 +99,7 @@ public void Start() public void Stop() { + Console.WriteLine($"Client cancellation issued from: {Environment.StackTrace}"); _cts.Cancel(); for (int i = 0; i < 60; ++i) { @@ -211,7 +216,7 @@ async Task RunWorker(int taskNum) } catch (Exception e) { - _aggregator.RecordFailure(e, opIndex, stopwatch.Elapsed, requestContext.IsCancellationRequested, taskNum: taskNum, iteration: i); + _aggregator.RecordFailure(e, opIndex, stopwatch.Elapsed, requestContext.IsCancellationRequested, _cts.IsCancellationRequested, taskNum: taskNum, iteration: i); } } @@ -230,12 +235,12 @@ private sealed class StressFailureType // Representative error text of stress failure public string ErrorText { get; } // Operation id => failure timestamps - public Dictionary> Failures { get; } + public Dictionary> Failures { get; } public StressFailureType(string errorText) { ErrorText = errorText; - Failures = new Dictionary>(); + Failures = new Dictionary>(); } public int FailureCount => Failures.Values.Select(x => x.Count).Sum(); @@ -280,7 +285,7 @@ public void RecordCancellation(int operationIndex, TimeSpan elapsed) _latencies.Add(elapsed.TotalMilliseconds); } - public void RecordFailure(Exception exn, int operationIndex, TimeSpan elapsed, bool isCancelled, int taskNum, long iteration) + public void RecordFailure(Exception exn, int operationIndex, TimeSpan elapsed, bool isCancelled, bool ctsState, int taskNum, long iteration) { DateTime timestamp = DateTime.Now; @@ -301,13 +306,13 @@ void RecordFailureType() lock (failureType) { - if(!failureType.Failures.TryGetValue(operationIndex, out List<(DateTime timestamp, TimeSpan duration, bool isCancelled)>? details)) + if (!failureType.Failures.TryGetValue(operationIndex, out List<(DateTime timestamp, TimeSpan duration, bool isCancelled, bool ctsState)>? details)) { - details = new List<(DateTime timestamp, TimeSpan duration, bool isCancelled)>(); + details = new List<(DateTime timestamp, TimeSpan duration, bool isCancelled, bool ctsState)>(); failureType.Failures.Add(operationIndex, details); } - details.Add((timestamp, elapsed, isCancelled)); + details.Add((timestamp, elapsed, isCancelled, ctsState)); } (Type exception, string message, string callSite)[] ClassifyFailure(Exception exn) @@ -335,7 +340,7 @@ void PrintToConsole() lock (Console.Out) { Console.ForegroundColor = ConsoleColor.Yellow; - Console.WriteLine($"Error from iteration {iteration} ({_operationNames[operationIndex]}) in task {taskNum} with {_successes.Sum()} successes / {_failures.Sum()} fails:"); + Console.WriteLine($"Error from iteration {iteration} ({_operationNames[operationIndex]}) in task {taskNum}, cancelled: {isCancelled}, is stop issues: {ctsState}, duration: {elapsed} with {_successes.Sum()} successes / {_failures.Sum()} fails:"); Console.ResetColor(); Console.WriteLine(exn); Console.WriteLine(); @@ -447,7 +452,7 @@ public void PrintFailureTypes() Console.WriteLine(failure.ErrorText); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Yellow; - foreach (KeyValuePair> operation in failure.Failures) + foreach (KeyValuePair> operation in failure.Failures) { Console.ForegroundColor = ConsoleColor.Cyan; Console.Write($"\t{_operationNames[operation.Key].PadRight(30)}"); @@ -456,7 +461,7 @@ public void PrintFailureTypes() Console.Write("Fail: "); Console.ResetColor(); Console.Write(operation.Value.Count); - Console.WriteLine($"\t{string.Join(", ", operation.Value.Select(x => $"Timestamps: {x.timestamp:HH:mm:ss.fffffff}, Duration: {x.duration}, Cancelled: {x.isCancelled}"))}"); + Console.WriteLine($"\t{string.Join(", ", operation.Value.Select(x => $"Timestamps: {x.timestamp:HH:mm:ss.fffffff}, Duration: {x.duration}, Cancelled: {x.isCancelled}, Stop Issued: {x.ctsState}"))}"); } Console.ForegroundColor = ConsoleColor.Cyan; diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile index b090d4eb24636..4c4539b43fd93 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile @@ -12,7 +12,6 @@ ARG VERSION=8.0 ARG CONFIGURATION=Release RUN dotnet build -c $env:CONFIGURATION ` - -p:MsQuicInteropIncludes="C:/live-runtime-artifacts/msquic-interop/*.cs" ` -p:TargetingPacksTargetsLocation=C:/live-runtime-artifacts/targetingpacks.targets ` -p:MicrosoftNetCoreAppRefPackDir=C:/live-runtime-artifacts/microsoft.netcore.app.ref/ ` -p:MicrosoftNetCoreAppRuntimePackDir=C:/live-runtime-artifacts/microsoft.netcore.app.runtime.win-x64/$env:CONFIGURATION/