diff --git a/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile b/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile index 08adb4359e05c1..2a232ee452418f 100644 --- a/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile +++ b/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile @@ -1,6 +1,6 @@ # Builds and copies library artifacts into target dotnet sdk image ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754 -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $BUILD_BASE_IMAGE as corefxbuild diff --git a/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile b/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile index dd306fc4ff126b..9fcb11a9a0c9ef 100644 --- a/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile +++ b/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile @@ -1,6 +1,6 @@ # escape=` # Simple Dockerfile which copies library build artifacts into target dotnet sdk image -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809 +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 FROM $SDK_BASE_IMAGE as target ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost" diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index 1d704ecbc42b3d..fd4f071da198d4 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -1,6 +1,6 @@ # Builds and copies library artifacts into target dotnet sdk image ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754 -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $BUILD_BASE_IMAGE as corefxbuild diff --git a/eng/docker/libraries-sdk.windows.Dockerfile b/eng/docker/libraries-sdk.windows.Dockerfile index 564378f4467293..c8d993b18d3894 100644 --- a/eng/docker/libraries-sdk.windows.Dockerfile +++ b/eng/docker/libraries-sdk.windows.Dockerfile @@ -1,6 +1,6 @@ # escape=` # Simple Dockerfile which copies clr and library build artifacts into target dotnet sdk image -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809 +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 FROM $SDK_BASE_IMAGE as target ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost" diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index 08b7611d211597..ba3a9f875f9e92 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -25,7 +25,7 @@ variables: jobs: - job: linux displayName: Docker Linux - timeoutInMinutes: 150 + timeoutInMinutes: 180 pool: name: NetCorePublic-Pool queue: BuildPool.Ubuntu.1804.Amd64.Open @@ -47,6 +47,14 @@ jobs: name: buildStress displayName: Build HttpStress + - bash: | + cd '$(httpStressProject)' + export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" + export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" + docker-compose up --abort-on-container-exit --no-color + displayName: Run HttpStress - HTTP 3.0 + condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) + - bash: | cd '$(httpStressProject)' export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 2.0" diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs index 2a0f211808b991..5708e48277eb90 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs @@ -42,7 +42,8 @@ public RequestContext(Configuration config, HttpClient httpClient, Random random public int TaskNum { get; } public bool IsCancellationRequested { get; private set; } - public Version HttpVersion => _config.HttpVersion; + public Version HttpVersion => _client.DefaultRequestVersion; + public HttpVersionPolicy VersionPolicy => _client.DefaultVersionPolicy; public int MaxRequestParameters => _config.MaxParameters; public int MaxRequestUriSize => _config.MaxRequestUriSize; public int MaxRequestHeaderCount => _config.MaxRequestHeaderCount; @@ -54,6 +55,7 @@ public RequestContext(Configuration config, HttpClient httpClient, Random random public async Task SendAsync(HttpRequestMessage request, HttpCompletionOption httpCompletion = HttpCompletionOption.ResponseContentRead, CancellationToken? token = null) { request.Version = HttpVersion; + request.VersionPolicy = VersionPolicy; if (token != null) { @@ -480,6 +482,12 @@ public static (string name, Func operation)[] Operations = private static void ValidateStatusCode(HttpResponseMessage m, HttpStatusCode expectedStatus = HttpStatusCode.OK) { + // [ActiveIssue("https://github.com/dotnet/runtime/issues/55261")] + if (m.StatusCode == HttpStatusCode.InternalServerError) + { + throw new Exception("IGNORE"); + } + if (m.StatusCode != expectedStatus) { throw new Exception($"Expected status code {expectedStatus}, got {m.StatusCode}"); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile index 00b1dd4e35e7e1..a097b5033d0830 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile @@ -1,4 +1,4 @@ -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $SDK_BASE_IMAGE RUN echo "DOTNET_SDK_VERSION="$DOTNET_SDK_VERSION @@ -7,6 +7,18 @@ RUN echo "DOTNET_VERSION="$DOTNET_VERSION WORKDIR /app COPY . . +# Pulling the msquic Debian package from msquic-ci public pipeline and from a hardcoded build. +# Note that this is a temporary solution until we have properly published Linux packages. +# Also note that in order to update to a newer msquic build, you have update this link. +ARG MSQUIC_PACKAGE=libmsquic_1.5.0_amd64.deb +ARG PACKAGES_DIR=LinuxPackages +RUN wget 'https://dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/builds/1223883/artifacts?artifactName=LinuxPackages&api-version=6.0&%24format=zip' -O "$PACKAGES_DIR".zip +RUN apt-get update +RUN apt-get install unzip +RUN unzip $PACKAGES_DIR.zip +RUN dpkg -i $PACKAGES_DIR/$MSQUIC_PACKAGE +RUN rm -rf $PACKAGES_DIR* + ARG CONFIGURATION=Release RUN dotnet build -c $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 57cbb0859dc804..db333cc634f6ca 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net6.0 preview enable @@ -13,6 +13,7 @@ + \ No newline at end of file diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/NuGet.config b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/NuGet.config new file mode 100644 index 00000000000000..0992c432038a9f --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/NuGet.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file 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 70d2cdbf149078..407c0acd0db25b 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -9,10 +9,14 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; +using System.Runtime.Versioning; using System.Threading.Tasks; using System.Net; using HttpStress; +[assembly:SupportedOSPlatform("windows")] +[assembly:SupportedOSPlatform("linux")] + /// /// Simple HttpClient stress app that launches Kestrel in-proc and runs many concurrent requests of varying types against it. /// 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 17db81103603dd..be0dd1c42b0636 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs @@ -65,8 +65,8 @@ HttpMessageHandler CreateHttpHandler() } } - return new HttpClient(CreateHttpHandler()) - { + return new HttpClient(CreateHttpHandler()) + { BaseAddress = _baseAddress, Timeout = _config.DefaultTimeout, DefaultRequestVersion = _config.HttpVersion, @@ -209,6 +209,11 @@ async Task RunWorker(int taskNum) { _aggregator.RecordCancellation(opIndex, stopwatch.Elapsed); } + catch (Exception e) when (e.Message == "IGNORE") + { + // [ActiveIssue("https://github.com/dotnet/runtime/issues/55261")] + // See ClientOperations.ValidateStatusCode + } catch (Exception e) { _aggregator.RecordFailure(e, opIndex, stopwatch.Elapsed, requestContext.IsCancellationRequested, taskNum: taskNum, iteration: i); @@ -283,7 +288,7 @@ public void RecordCancellation(int operationIndex, TimeSpan elapsed) public void RecordFailure(Exception exn, int operationIndex, TimeSpan elapsed, bool isCancelled, int taskNum, long iteration) { DateTime timestamp = DateTime.Now; - + Interlocked.Increment(ref _totalRequests); Interlocked.Increment(ref _failures[operationIndex]); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs index 6012965d2a5097..32927f7b1ae124 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs @@ -45,7 +45,7 @@ public StressServer(Configuration configuration) (string scheme, string hostname, int port) = ParseServerUri(configuration.ServerUri); IWebHostBuilder host = WebHost.CreateDefaultBuilder(); - if (configuration.UseHttpSys) + if (configuration.UseHttpSys && OperatingSystem.IsWindows()) { // Use http.sys. This requires additional manual configuration ahead of time; // see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/httpsys?view=aspnetcore-2.2#configure-windows-server. @@ -108,16 +108,29 @@ void ConfigureListenOptions(ListenOptions listenOptions) } listenOptions.UseHttps(cert); } + if (configuration.HttpVersion == HttpVersion.Version30) + { + listenOptions.Protocols = HttpProtocols.Http3; + } } else { listenOptions.Protocols = - configuration.HttpVersion == new Version(2,0) ? + configuration.HttpVersion == HttpVersion.Version20 ? HttpProtocols.Http2 : HttpProtocols.Http1 ; } } }); + + if (configuration.HttpVersion == HttpVersion.Version30) + { + host = host.UseQuic(options => + { + options.Alpn = "h3-29"; + options.IdleTimeout = TimeSpan.FromMinutes(1); + }); + } }; LoggerConfiguration loggerConfiguration = new LoggerConfiguration(); @@ -161,7 +174,7 @@ void ConfigureListenOptions(ListenOptions listenOptions) private static void MapRoutes(IEndpointRouteBuilder endpoints) { var loggerFactory = endpoints.ServiceProvider.GetService(); - var logger = loggerFactory.CreateLogger(); + var logger = loggerFactory?.CreateLogger(); var head = new[] { "HEAD" }; endpoints.MapGet("/", async context => 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 43f1da1deca245..17cb0567199a16 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile @@ -1,5 +1,5 @@ # escape=` -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809 +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 FROM $SDK_BASE_IMAGE # Use powershell as the default shell diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/NetEventSource.Quic.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/NetEventSource.Quic.cs index d86d7c6fc77120..66d66f0e40987f 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/NetEventSource.Quic.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/NetEventSource.Quic.cs @@ -5,7 +5,7 @@ namespace System.Net { - [EventSource(Name = "Microsoft-System-Net-Quic")] + [EventSource(Name = "Private.InternalDiagnostics.System.Net.Quic")] internal sealed partial class NetEventSource : EventSource { } diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile index dcf3b9ecc9f9e0..8e97f642a73b4e 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile @@ -1,4 +1,4 @@ -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $SDK_BASE_IMAGE RUN echo "DOTNET_SDK_VERSION="$DOTNET_SDK_VERSION @@ -6,7 +6,7 @@ RUN echo "DOTNET_VERSION="$DOTNET_VERSION WORKDIR /app COPY . . -WORKDIR /app/System.Net.Security/tests/StressTests/SslStress +WORKDIR /app/System.Net.Security/tests/StressTests/SslStress ARG CONFIGURATION=Release RUN dotnet build -c $CONFIGURATION diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj b/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj index 3221dd6cd13cb5..8b0a7a0aea1882 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj @@ -1,15 +1,14 @@ Exe - net5.0 + net6.0 enable - + - + diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.sh b/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.sh index e18b80fca1dc35..91872f5e8a2c99 100755 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.sh +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.sh @@ -89,6 +89,13 @@ fi compose_file="$scriptroot/docker-compose.yml" +if ! docker-compose --file "$compose_file" pull client; then + exit $? +fi +if ! docker-compose --file "$compose_file" pull server; then + exit $? +fi + if ! docker-compose --file "$compose_file" build $build_args; then exit $? fi diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/windows.Dockerfile b/src/libraries/System.Net.Security/tests/StressTests/SslStress/windows.Dockerfile index 02e23f5c1c9a3a..a1449eb4d54157 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/windows.Dockerfile +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/windows.Dockerfile @@ -1,5 +1,5 @@ # escape=` -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809 +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 FROM $SDK_BASE_IMAGE # Use powershell as the default shell @@ -10,7 +10,7 @@ RUN echo "DOTNET_VERSION="$env:DOTNET_VERSION WORKDIR /app COPY . . -WORKDIR /app/System.Net.Security/tests/StressTests/SslStress +WORKDIR /app/System.Net.Security/tests/StressTests/SslStress ARG CONFIGURATION=Release RUN dotnet build -c $env:CONFIGURATION