-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HostFactoryResolver - Increase default timeout to thirty seconds #61621
Conversation
Tagging subscribers to this area: @eerhardt, @maryamariyan Issue Details
|
@@ -22,7 +22,7 @@ internal sealed class HostFactoryResolver | |||
public const string CreateHostBuilder = nameof(CreateHostBuilder); | |||
|
|||
// The amount of time we wait for the diagnostic source events to fire | |||
private static readonly TimeSpan s_defaultWaitTimeout = Debugger.IsAttached ? Timeout.InfiniteTimeSpan : TimeSpan.FromSeconds(5); | |||
private static readonly TimeSpan s_defaultWaitTimeout = Debugger.IsAttached ? Timeout.InfiniteTimeSpan : TimeSpan.FromMinutes(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming we improve the error message to make it clear that there was a timeout, are we worried that people will just kill the migration before seeing the error if we make this a full minute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updates exception messaging and changed it to 30 seconds, assuming we would keep the environment variable option.
src/libraries/Microsoft.Extensions.HostFactoryResolver/src/HostFactoryResolver.cs
Outdated
Show resolved
Hide resolved
…tFactoryResolver.cs Co-authored-by: Stephen Halter <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
How did we land on 30 seconds? Just FYI, the reason the keyvault configuration provider tends to be the one that times out is because it makes an HTTP request per key, value pair to get the initial set of configuration values. The default should be like 5 minutes to just cover those scenarios. |
My thought was, since we are allowing to accept environment variables then it's fair to reduce to 30 seconds. Also because of @halter73 's comment below:
|
It should be more than 30 seconds because of the keyvault scenario (if you want some concrete data, look for keyvault configuration provider issues). My vote is 5 minutes |
src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/HostFactoryResolverTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/HostFactoryResolverTests.cs
Outdated
Show resolved
Hide resolved
...ies/Microsoft.Extensions.HostFactoryResolver/tests/TopLevelStatementsTestsTimeout/Program.cs
Outdated
Show resolved
Hide resolved
…ostFactoryResolverTests.cs
…opLevelStatementsTestsTimeout/Program.cs
Customer Impact
When customer has debugger attached or when using tools like EF, host startup path using WebApplicationBuilder for hosting and WebApplicationFactory for testing, may fail to build and throw an InvalidOperationException with the message “Unable to build IHost.”, because the default timeout is only 5 seconds.
We are proposing to use a higher timeout (1 minute) to be used so that when an application is taking longer to build, we could allow startup code to complete, and the host can start successfully.
Increasing the timeout should not have a negative impact on experience.
TODO
Risk
Very low.
Regression
No, new 6.0 feature/code flow for discovering a host.
Even though this is not a regression (uses WebApplicationBuilder which is new), but since this code is in the ASP.NET Core templates, it regresses the scenario when using default templates.
Fixes #60891, dotnet/aspnetcore#33886