Skip to content

Kestrel ListenAnyIP error #21423

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

Closed
JamesNK opened this issue May 2, 2020 · 1 comment
Closed

Kestrel ListenAnyIP error #21423

JamesNK opened this issue May 2, 2020 · 1 comment
Assignees
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed feature-kestrel

Comments

@JamesNK
Copy link
Member

JamesNK commented May 2, 2020

Potentially a bug introduced by #21072

https://dev.azure.com/dnceng/internal/_build/results?buildId=626982&view=logs&j=ab336984-fd17-5476-0984-4a0b5ed8658e&t=89066a81-cbc6-5313-1cbd-e2259a0b7533

Error:

[STDERR] Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
[STDERR]    at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.ApplyConfigurationDefaults(ListenOptions listenOptions)
[STDERR]    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions.ApplyEndpointDefaults(ListenOptions listenOptions)
[STDERR]    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions.ListenAnyIP(Int32 port, Action`1 configure)
[STDERR]    at GrpcAspNetCoreServer.Program.<>c__DisplayClass1_0.<CreateHostBuilder>b__3(WebHostBuilderContext context, KestrelServerOptions options) in C:\Users\Administrator\AppData\Local\Temp\benchmarks-agent\benchmarks-server-5140\etf3ezdi.lfc\grpc-dotnet\perf\benchmarkapps\GrpcAspNetCoreServer\Program.cs:line 68
[STDERR]    at Microsoft.AspNetCore.Hosting.WebHostBuilderKestrelExtensions.<>c__DisplayClass4_1.<ConfigureKestrel>b__1(KestrelServerOptions options)
[STDERR]    at Microsoft.Extensions.Options.ConfigureNamedOptions`1.Configure(String name, TOptions options)
[STDERR]    at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
[STDERR]    at Microsoft.Extensions.Options.OptionsManager`1.<>c__DisplayClass5_0.<Get>b__0()
[STDERR]    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
[STDERR]    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
[STDERR]    at System.Lazy`1.CreateValue()
[STDERR]    at System.Lazy`1.get_Value()
[STDERR]    at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
[STDERR]    at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
[STDERR]    at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
[STDERR]    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.CreateServiceContext(IOptions`1 options, ILoggerFactory loggerFactory)
[STDERR]    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer..ctor(IOptions`1 options, IEnumerable`1 transportFactories, IEnumerable`1 multiplexedFactories, ILoggerFactory loggerFactory)

Usage:
https://github.com/grpc/grpc-dotnet/blob/54add4f70f9154024573c1bb99c8450f5ee2a132/perf/benchmarkapps/GrpcAspNetCoreServer/Program.cs#L68

@halter73 @sebastienros

@halter73 halter73 self-assigned this May 2, 2020
@halter73
Copy link
Member

halter73 commented May 2, 2020

Yikes. Definitely a regression caused by #21072.

Looking at the usage, I'm wondering how KestrelServerOptions.ConfigurationLoader is getting set. I think there needs to be a call to KSO.Configure somewhere, but I don't see it.

Regardless, this NullReferenceException could happen if KSO.Configure() is called and then KSO.Listen*() without a call to KestrelConfigurationLoader.Load() in between. This, of course, shouldn't happen.

@halter73 halter73 added the bug This issue describes a behavior which is not expected - a bug. label May 2, 2020
@Tratcher Tratcher added this to the 5.0.0-preview5 milestone May 5, 2020
@Tratcher Tratcher closed this as completed May 5, 2020
@Tratcher Tratcher added Done This issue has been fixed feature-kestrel labels May 5, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jun 4, 2020
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed feature-kestrel
Projects
None yet
Development

No branches or pull requests

4 participants