From 71c0cae6c016e02cffa9de2805bfb0d5e0318204 Mon Sep 17 00:00:00 2001 From: BrennanConroy <7574801+BrennanConroy@users.noreply.github.com> Date: Wed, 4 Nov 2026 07:33:30 +0000 Subject: [PATCH 1/3] Stabilize IIS child process restart test Wait for the original out-of-process worker to exit before polling the replacement, avoiding response-body logging against a connection being forcibly closed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs b/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs index 4bfc8fb5f242..3c212611bc64 100644 --- a/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs +++ b/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs @@ -467,10 +467,13 @@ public async Task ConfigurationChangeForcesChildProcessRestart() var deploymentResult = await DeployAsync(deploymentParameters); var processBefore = await deploymentResult.HttpClient.GetStringAsync("/ProcessId"); + using var process = System.Diagnostics.Process.GetProcessById(int.Parse(processBefore)); // Just "touching" web.config should be enough deploymentResult.ModifyWebConfig(element => { }); + await process.WaitForExitAsync().DefaultTimeout(); + // Have to retry here to allow ANCM to receive notification and react to it // Verify that worker process gets restarted with new process id await deploymentResult.HttpClient.RetryRequestAsync("/ProcessId", async r => await r.Content.ReadAsStringAsync() != processBefore); From d6074d1f885cc082f6b8cc5f06653111889b5029 Mon Sep 17 00:00:00 2001 From: BrennanConroy <7574801+BrennanConroy@users.noreply.github.com> Date: Wed, 4 Nov 2026 08:12:37 +0000 Subject: [PATCH 2/3] Use invariant culture for process ID parsing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs b/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs index 3c212611bc64..fb6441be5a84 100644 --- a/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs +++ b/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Globalization; using System.Net; using System.Net.Http; using System.Net.Sockets; @@ -467,7 +468,7 @@ public async Task ConfigurationChangeForcesChildProcessRestart() var deploymentResult = await DeployAsync(deploymentParameters); var processBefore = await deploymentResult.HttpClient.GetStringAsync("/ProcessId"); - using var process = System.Diagnostics.Process.GetProcessById(int.Parse(processBefore)); + using var process = System.Diagnostics.Process.GetProcessById(int.Parse(processBefore, CultureInfo.InvariantCulture)); // Just "touching" web.config should be enough deploymentResult.ModifyWebConfig(element => { }); From 754cf292c3b71ab8e91a87c7b50744da2a70adb8 Mon Sep 17 00:00:00 2001 From: BrennanConroy <7574801+BrennanConroy@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:05:03 +0000 Subject: [PATCH 3/3] Retry IIS child process restart assertion Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../IIS/IIS/test/Common.LongTests/ShutdownTests.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs b/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs index fb6441be5a84..bcab0699348c 100644 --- a/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs +++ b/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Globalization; using System.Net; using System.Net.Http; using System.Net.Sockets; @@ -468,16 +467,17 @@ public async Task ConfigurationChangeForcesChildProcessRestart() var deploymentResult = await DeployAsync(deploymentParameters); var processBefore = await deploymentResult.HttpClient.GetStringAsync("/ProcessId"); - using var process = System.Diagnostics.Process.GetProcessById(int.Parse(processBefore, CultureInfo.InvariantCulture)); // Just "touching" web.config should be enough deploymentResult.ModifyWebConfig(element => { }); - await process.WaitForExitAsync().DefaultTimeout(); - - // Have to retry here to allow ANCM to receive notification and react to it - // Verify that worker process gets restarted with new process id - await deploymentResult.HttpClient.RetryRequestAsync("/ProcessId", async r => await r.Content.ReadAsStringAsync() != processBefore); + // Requests can be interrupted while ANCM replaces the worker, so retry both + // transient request failures and responses from the original process. + await Helpers.Retry(async () => + { + var processAfter = await deploymentResult.HttpClient.GetStringAsync("/ProcessId"); + Assert.NotEqual(processBefore, processAfter); + }, TimeSpan.FromSeconds(10)); } [ConditionalFact]