GithubHelp home page GithubHelp logo

Comments (5)

SeppPenner avatar SeppPenner commented on May 28, 2024

Some more logging output (Shows that the options are set properly:

silo-1  | 05.03.24 15:42:26.609    [INF]   Configuration Orleans.Configuration.EndpointOptions:
silo-1  | AdvertisedIPAddress: 192.168.201.36
silo-1  | SiloPort: 11111
silo-1  | GatewayPort: 30000
silo-1  | SiloListeningEndpoint: 0.0.0.0:11111
silo-1  | GatewayListeningEndpoint: 0.0.0.0:30000

from orleans.

SeppPenner avatar SeppPenner commented on May 28, 2024

The server has the following configuration options (Should be ok as well, I guess)

{
    "SiloIpAddress": "192.168.201.36",
    "GatewayPort": 30000
}

from orleans.

SeppPenner avatar SeppPenner commented on May 28, 2024

Something more to mention: We use a background service that implements BackgroundService from Microsoft.Extensions.Hosting. In there, we create a Orleans client. The client is needed to perform some checks on Silo startup. The client runs "locally" in the Silo itself and seems to be causing the issue...

private async Task<IClusterClient> CreateLocalOrleansClient()
{
    var siloIpAddress = this.advertisedSiloIp;

    if (Program.InCompose)
    {
        siloIpAddress = IPAddress.Any;
    }

    this.logger.Information("Initializing OrleansRpc client for silo ip {IpAddress}...", siloIpAddress);

    var orleansClient = new ClientBuilder().Configure<ClusterOptions>(
            options =>
            {
                options.ClusterId = this.configuration.ClusterId;
                options.ServiceId = this.configuration.ServiceId;
            })
        .UseStaticClustering(new IPEndPoint(siloIpAddress, this.configuration.GatewayPort))
        .ConfigureApplicationParts(
            parts =>
            {
                parts.AddApplicationPart(typeof(ISomethingGrain).Assembly).WithReferences();
            })
        .ConfigureLogging(l => l.AddSerilog())
        .AddSimpleMessageStreamProvider(StreamGlobals.SmsProvider)
        .Build();
    await orleansClient.Connect();
    return orleansClient;
}

from orleans.

SeppPenner avatar SeppPenner commented on May 28, 2024

Something more to mention: We use a background service that implements BackgroundService from Microsoft.Extensions.Hosting. In there, we create a Orleans client. The client is needed to perform some checks on Silo startup. The client runs "locally" in the Silo itself and seems to be causing the issue...

private async Task<IClusterClient> CreateLocalOrleansClient()
{
    var siloIpAddress = this.advertisedSiloIp;

    if (Program.InCompose)
    {
        siloIpAddress = IPAddress.Any;
    }

    this.logger.Information("Initializing OrleansRpc client for silo ip {IpAddress}...", siloIpAddress);

    var orleansClient = new ClientBuilder().Configure<ClusterOptions>(
            options =>
            {
                options.ClusterId = this.configuration.ClusterId;
                options.ServiceId = this.configuration.ServiceId;
            })
        .UseStaticClustering(new IPEndPoint(siloIpAddress, this.configuration.GatewayPort))
        .ConfigureApplicationParts(
            parts =>
            {
                parts.AddApplicationPart(typeof(ISomethingGrain).Assembly).WithReferences();
            })
        .ConfigureLogging(l => l.AddSerilog())
        .AddSimpleMessageStreamProvider(StreamGlobals.SmsProvider)
        .Build();
    await orleansClient.Connect();
    return orleansClient;
}

I have reworked this now following https://learn.microsoft.com/en-us/dotnet/orleans/host/client?pivots=orleans-3-x.

The IClusterClient is now injected per DI, the issue persists, however...

from orleans.

SeppPenner avatar SeppPenner commented on May 28, 2024

Again an update: The issue persists, but the server project now causes the issue, the Silo itself can be started properly...
The client in the server project is initialized like this:

var gateways = this.configuration.OrleansSiloEndPoints; // This is just 192.168.201.36, port 30000 from the configuration.
// It's loaded properly, I check that. --> It's irrelevant as well as the gatewys are overwritten below with the environment variable.

if (Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_COMPOSE")?.ToLowerInvariant() == "true")
{
    var addresses = Dns.GetHostAddresses("server");
    gateways = addresses.Select(a => new IPEndPoint(a, 30000)).ToArray();
}

var client = new ClientBuilder()
    .Configure<ClusterOptions>(
        options =>
        {
            options.ClusterId = this.configuration.ClusterId;
            options.ServiceId = this.configuration.ServiceId;
        })
    .Configure<ClientMessagingOptions>(opts =>
    {
        opts.ResponseTimeout = TimeSpan.FromSeconds(90);
    })
    .Configure<MessagingOptions>(opts =>
    {
        opts.ResponseTimeout = TimeSpan.FromSeconds(90);
    })
    .UseStaticClustering(gateways)
    .ConfigureApplicationParts(parts =>
        {
            parts.AddApplicationPart(typeof(ISomethingGrain).Assembly).WithReferences();
        })
    .ConfigureLogging(logging => logging.AddSerilog())
    .Configure<ClientMessagingOptions>(options => options.MaxMessageBodySize = 134217728) //128 MB
        .AddSimpleMessageStreamProvider("SmsProvider")
        .Build();

from orleans.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.