Skip to content
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

Orleans + ASP.NET co-hosting can cause NullReferenceException in ASP.NET #6040

Closed
ReubenBond opened this issue Oct 11, 2019 · 0 comments · Fixed by #6042
Closed

Orleans + ASP.NET co-hosting can cause NullReferenceException in ASP.NET #6040

ReubenBond opened this issue Oct 11, 2019 · 0 comments · Fixed by #6042
Assignees
Labels
stale Issues with no activity for the past 6 months
Milestone

Comments

@ReubenBond
Copy link
Member

This is specific to Orleans 3.0-rc1.

Currently both Orleans & Kestrel register an implementation for IConnectionListenerFactory. Both have different requirements of the created ConnectionContexts, however and so when they are both configured on the same IHostBuilder/container we can observe NullReferenceExceptions from ASP.NET. Registering them in the reverse order would likely cause similar issues in Orleans.

Example:

Host.CreateDefaultBuilder(args)
    .UseOrleans((context, builder) =>
    {
        builder
            .Configure<SiloMessagingOptions>(opts =>
            {
                opts.PropagateActivityId = true;
            })
            .UseLocalhostClustering()
            .AddMemoryGrainStorageAsDefault();
    })
    .ConfigureWebHostDefaults(webBuilder =>
    {
        webBuilder.UseStartup<Startup>();
    });

Kestrel registers an implementation here: https://github.com/aspnet/AspNetCore/blob/00e0b97466a3aa7e535b1e34fb04c11f5970fb28/src/Servers/Kestrel/Kestrel/src/WebHostBuilderKestrelExtensions.cs#L32

Orleans registers an implementation here:

services.TryAddSingleton<IConnectionListenerFactory, SocketConnectionListenerFactory>();

We can change our registration to disambiguate it from Kestrel's, but issues may occur with other users of these abstractions. I imagine the problem would also exist with IConnectionFactory (eg, maybe Orleans + SignalR).

cc @davidfowl

@ReubenBond ReubenBond added this to the 3.0.0 milestone Oct 11, 2019
@ReubenBond ReubenBond self-assigned this Oct 11, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Sep 25, 2021
@ghost ghost added the stale Issues with no activity for the past 6 months label Dec 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale Issues with no activity for the past 6 months
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant