orleans icon indicating copy to clipboard operation
orleans copied to clipboard

One or more errors occurred. (Not connected to a gateway)

Open madhuchowlur opened this issue 8 years ago • 4 comments

Hi,

We are running 2 small sized worker roles (Orleans 2.0) and client app service (ASP.Net core) also networked as per the documentation App service and orleans silo(cloudservice) share same vNET and configured the subnet of vNET to Network security group. Both workerrole and appservice use same clusterId and serviceId.

While trying to connect from azure app service(client) to orleans silo(workerrole) am getting an error in client as "Not connected to a gateway" can someone help me what configurations should do to resolve this?

Below is the error log

An error occurred while starting the application. AggregateException: One or more errors occurred. (Not connected to a gateway) System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)

OrleansException: Not connected to a gateway Orleans.Messaging.ClientMessageCenter.GetLiveGatewaySiloAddress()

AggregateException: One or more errors occurred. (Not connected to a gateway) System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions) System.Threading.Tasks.Task.Wait(int millisecondsTimeout, CancellationToken cancellationToken) NetCoreSPA.Startup+<>c__DisplayClass5_0.b__0(IServiceProvider sp) in Startup.cs Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite callSite, TArgument argument) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor.VisitCallSite(IServiceCallSite callSite, TArgument argument) Microsoft.Extensions.DependencyInjection.ServiceProvider+<>c__DisplayClass22_0.b__0(ServiceProvider provider) Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService(IServiceProvider provider) NetCoreSPA.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in Startup.cs System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter+<>c__DisplayClass3_0.b__0(IApplicationBuilder app) Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.b__0(IApplicationBuilder builder) Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Show raw exception details OrleansException: Not connected to a gateway Orleans.Messaging.ClientMessageCenter.GetLiveGatewaySiloAddress() Orleans.Messaging.ClientMessageCenter.GetImplicitStreamSubscriberTable(IInternalGrainFactory grainFactory) Orleans.OutsideRuntimeClient+d__56.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Orleans.OutsideRuntimeClient+<g__ExecuteWithRetries58_3>d.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Orleans.OutsideRuntimeClient+d__58.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Orleans.OutsideRuntimeClient+d__57.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Orleans.ClusterClient+d__19.MoveNext()

Show raw exception details Orleans.Runtime.OrleansException: Not connected to a gateway at Orleans.Messaging.ClientMessageCenter.GetLiveGatewaySiloAddress() at Orleans.Messaging.ClientMessageCenter.GetImplicitStreamSubscriberTable(IInternalGrainFactory grainFactory) at Orleans.OutsideRuntimeClient.d__56.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.OutsideRuntimeClient.<g__ExecuteWithRetries58_3>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.OutsideRuntimeClient.d__58.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.OutsideRuntimeClient.d__57.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Orleans.ClusterClient.d__19.MoveNext()

image

madhuchowlur avatar Apr 11 '18 08:04 madhuchowlur

the documentation link you have there is for Orleans 1.5 and before . Here is the 2.0 link : http://dotnet.github.io/orleans/Documentation/Migration/MigrationAzure2.0.html

And we also have azure worker role sample upgradedto use 2.0, which can serve as a good guide.

My suspection for the exception is your clustering config isn't correct. It's likely because you followed the old docs. But without your config code, I cannot be sure. So I suggest you look at the new docs and sample, go from there. Welcome to post further question if you have on the new 2.0 docs

xiazen avatar Apr 11 '18 21:04 xiazen

@xiazen Thanks for the suggestion, Documentation which i was referring was from the Orleans 2.0 Documentation image

image

We are following the same example (AzureWorkerRoleSample) which you referenced in your comment

Here is the Silo configurations from my code private Task RunAsync(CancellationToken cancellationToken) { try { var proxyPort = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["OrleansProxyEndpoint"].IPEndpoint.Port; var siloEndpoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["OrleansSiloEndpoint"].IPEndpoint; var connectionString = RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"); var deploymentId = RoleEnvironment.DeploymentId; var builder = new SiloHostBuilder() .Configure<ClusterOptions>(options => { options.ClusterId = "dev"; options.ServiceId = "AzureWorkerRoleSample"; }) .Configure<SiloOptions>(Options=>Options.SiloName=this.Name) .Configure<EndpointOptions>(options=> { options.AdvertisedIPAddress = IPAddress.Loopback; options.SiloPort = 11111;options.GatewayPort = 30000; }) .UseAzureStorageClustering(options => options.ConnectionString = connectionString) .UseDashboard(Options=> { }); siloHost = builder.Build(); } catch(Exception ex) { telemetry.TrackException(ex); } return siloHost.StartAsync(cancellationToken); }

Here is my Client application(ASP.Net Core) startup class where we initialize grain

`public class Startup { TelemetryClient telemetry = new TelemetryClient(); public Startup(IConfiguration configuration) { TelemetryConfiguration.Active.InstrumentationKey = "myInstrumentationKey"; Configuration = configuration; }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {

        string connectionString = "DefaultEndpointsProtocol=https;AccountName=<my Account Name>;AccountKey=<my account key>;EndpointSuffix=core.windows.net";
        #region ORLEANS Grainfactory configuration
        services.AddSingleton<IGrainFactory>(sp =>
            {
                var builder = new ClientBuilder()
                .UseAzureStorageClustering(options => options.ConnectionString = connectionString)
                //.LoadConfiguration()
                .Configure<ClusterOptions>(options =>
                {
                    options.ClusterId = "dev";
                    options.ServiceId = "AzureWorkerRoleSample";
                })
                .ConfigureLogging(logging => logging.AddConsole())
                .Build();
                builder.Connect().Wait();
                return builder;
            });
        #endregion

        services.AddMvc();
        services.AddCors(o => o.AddPolicy("AppPolicy", builder =>
        {
            builder.AllowAnyOrigin()
                   .AllowAnyMethod()
                   .AllowAnyHeader();
        }));
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env)
    {
        #region adding IgrainFactory to app
        app.ApplicationServices.GetService<IGrainFactory>();
        #endregion

        if (env.IsDevelopment())
        {
            app.UseBrowserLink();
            app.UseDeveloperExceptionPage();
        }

        // Middleware to Handle Client Side Routes
        app.Use(async (context, next) =>
        {
            await next();
            if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
            {
                context.Request.Path = "/index.html";
                context.Response.StatusCode = 200;
                await next();
            }
        });

        DefaultFilesOptions options = new DefaultFilesOptions();
        options.DefaultFileNames.Clear();
        options.DefaultFileNames.Add("/index.html");
        app.UseDefaultFiles(options);

        app.UseStaticFiles();
        app.UseFileServer(enableDirectoryBrowsing: false);
        app.UseMvc();

    }
}

} `

We are able to run the application smoothly in local environment.

But when we deploy client as app service and silo as worker role (cloud service) by configuring the vNet for app service and cloud service communication is not happening between client and silo.

madhuchowlur avatar Apr 13 '18 05:04 madhuchowlur

@madhuchowlur could you test that the client VMs have network connectivity to the silo VMs? Also verify that the firewall is not blocking communication.

ReubenBond avatar Apr 18 '18 22:04 ReubenBond

Closing due to inactivity. Please reopen if needed 🙂

ReubenBond avatar Jun 25 '18 22:06 ReubenBond