Skip to content

Commit 9036b0c

Browse files
authored
Merge branch 'release/5.0-rc2' into merge/release/5.0-to-release/5.0-rc2
2 parents ecdcc75 + 474f947 commit 9036b0c

File tree

7 files changed

+279
-228
lines changed

7 files changed

+279
-228
lines changed

eng/Version.Details.xml

Lines changed: 148 additions & 148 deletions
Large diffs are not rendered by default.

eng/Versions.props

Lines changed: 75 additions & 75 deletions
Large diffs are not rendered by default.

src/Servers/IIS/AspNetCoreModuleV2/CommonLib/ConfigurationSection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#define CS_ENABLED L"enabled"
3131
#define CS_ASPNETCORE_HANDLER_CALL_STARTUP_HOOK L"callStartupHook"
3232
#define CS_ASPNETCORE_HANDLER_STACK_SIZE L"stackSize"
33+
#define CS_ASPNETCORE_SUPPRESS_RECYCLE_ON_STARTUP_TIMEOUT L"suppressRecycleOnStartupTimeout"
3334
#define CS_ASPNETCORE_DETAILEDERRORS L"ASPNETCORE_DETAILEDERRORS"
3435
#define CS_ASPNETCORE_ENVIRONMENT L"ASPNETCORE_ENVIRONMENT"
3536
#define CS_DOTNET_ENVIRONMENT L"DOTNET_ENVIRONMENT"

src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ InProcessOptions::InProcessOptions(const ConfigurationSource &configurationSourc
6666
m_fSetCurrentDirectory = equals_ignore_case(find_element(handlerSettings, CS_ASPNETCORE_HANDLER_SET_CURRENT_DIRECTORY).value_or(L"true"), L"true");
6767
m_fCallStartupHook = equals_ignore_case(find_element(handlerSettings, CS_ASPNETCORE_HANDLER_CALL_STARTUP_HOOK).value_or(L"true"), L"true");
6868
m_strStackSize = find_element(handlerSettings, CS_ASPNETCORE_HANDLER_STACK_SIZE).value_or(L"1048576");
69+
m_fSuppressRecycleOnStartupTimeout = equals_ignore_case(find_element(handlerSettings, CS_ASPNETCORE_SUPPRESS_RECYCLE_ON_STARTUP_TIMEOUT).value_or(L"false"), L"true");
6970

7071
m_dwStartupTimeLimitInMS = aspNetCoreSection->GetRequiredLong(CS_ASPNETCORE_PROCESS_STARTUP_TIME_LIMIT) * 1000;
7172
m_dwShutdownTimeLimitInMS = aspNetCoreSection->GetRequiredLong(CS_ASPNETCORE_PROCESS_SHUTDOWN_TIME_LIMIT) * 1000;

src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ class InProcessOptions: NonCopyable
118118
return m_strStackSize;
119119
}
120120

121+
bool
122+
QuerySuppressRecycleOnStartupTimeout() const
123+
{
124+
return m_fSuppressRecycleOnStartupTimeout;
125+
}
126+
121127
InProcessOptions(const ConfigurationSource &configurationSource, IHttpSite* pSite);
122128

123129
static
@@ -139,6 +145,7 @@ class InProcessOptions: NonCopyable
139145
bool m_fWindowsAuthEnabled;
140146
bool m_fBasicAuthEnabled;
141147
bool m_fAnonymousAuthEnabled;
148+
bool m_fSuppressRecycleOnStartupTimeout;
142149
DWORD m_dwStartupTimeLimitInMS;
143150
DWORD m_dwShutdownTimeLimitInMS;
144151
DWORD m_dwMaxRequestBodySize;

src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,14 @@ IN_PROCESS_APPLICATION::LoadManagedApplication(ErrorContext& errorContext)
169169
errorContext.errorReason = format("ASP.NET Core app failed to start after %d milliseconds", m_pConfig->QueryStartupTimeLimitInMS());
170170

171171
m_waitForShutdown = false;
172-
StopClr();
172+
if (m_pConfig->QuerySuppressRecycleOnStartupTimeout())
173+
{
174+
StopClr();
175+
}
176+
else
177+
{
178+
Stop(/* fServerInitiated */false);
179+
}
173180
throw InvalidOperationException(format(L"Managed server didn't initialize after %u ms.", m_pConfig->QueryStartupTimeLimitInMS()));
174181
}
175182

src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,10 @@ public async Task RemoveInProcessReference_FailedToFindRequestHandler()
453453
}
454454

455455
[ConditionalFact]
456+
[RequiresNewHandler]
456457
public async Task StartupTimeoutIsApplied()
457458
{
458-
// From what I can tell, this failure is due to ungraceful shutdown.
459+
// From what we can tell, this failure is due to ungraceful shutdown.
459460
// The error could be the same as https://github.com/dotnet/core-setup/issues/4646
460461
// But can't be certain without another repro.
461462
using (AppVerifier.Disable(DeployerSelector.ServerType, 0x300))
@@ -470,11 +471,45 @@ public async Task StartupTimeoutIsApplied()
470471
var response = await deploymentResult.HttpClient.GetAsync("/");
471472
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
472473

474+
// Startup timeout now recycles process.
475+
deploymentResult.AssertWorkerProcessStop();
476+
477+
EventLogHelpers.VerifyEventLogEvent(deploymentResult,
478+
EventLogHelpers.InProcessFailedToStart(deploymentResult, "Managed server didn't initialize after 1000 ms."),
479+
Logger);
480+
481+
if (DeployerSelector.HasNewHandler)
482+
{
483+
var responseContent = await response.Content.ReadAsStringAsync();
484+
Assert.Contains("500.37", responseContent);
485+
}
486+
}
487+
}
488+
489+
[ConditionalFact]
490+
[MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_20H1, SkipReason = "Shutdown hangs https://github.com/dotnet/aspnetcore/issues/25107")]
491+
public async Task StartupTimeoutIsApplied_DisableRecycleOnStartupTimeout()
492+
{
493+
// From what we can tell, this failure is due to ungraceful shutdown.
494+
// The error could be the same as https://github.com/dotnet/core-setup/issues/4646
495+
// But can't be certain without another repro.
496+
using (AppVerifier.Disable(DeployerSelector.ServerType, 0x300))
497+
{
498+
var deploymentParameters = Fixture.GetBaseDeploymentParameters(Fixture.InProcessTestSite);
499+
deploymentParameters.TransformArguments((a, _) => $"{a} Hang");
500+
deploymentParameters.WebConfigActionList.Add(
501+
WebConfigHelpers.AddOrModifyAspNetCoreSection("startupTimeLimit", "1"));
502+
deploymentParameters.HandlerSettings["suppressRecycleOnStartupTimeout"] = "true";
503+
var deploymentResult = await DeployAsync(deploymentParameters);
504+
505+
var response = await deploymentResult.HttpClient.GetAsync("/");
506+
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
507+
473508
StopServer(gracefulShutdown: false);
474509

475-
EventLogHelpers.VerifyEventLogEvents(deploymentResult,
476-
EventLogHelpers.InProcessFailedToStart(deploymentResult, "Managed server didn't initialize after 1000 ms.")
477-
);
510+
EventLogHelpers.VerifyEventLogEvent(deploymentResult,
511+
EventLogHelpers.InProcessFailedToStart(deploymentResult, "Managed server didn't initialize after 1000 ms."),
512+
Logger);
478513

479514
if (DeployerSelector.HasNewHandler)
480515
{

0 commit comments

Comments
 (0)