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

[Feature]: Avoid repeated calls to CreateServiceInstanceListeners method if an exception popped #1511

Open
yshi1018 opened this issue Sep 27, 2024 · 0 comments
Labels
type-enhancement New feature or request

Comments

@yshi1018
Copy link

Is your feature request related to a problem? Please describe your workload details.
I built a .net service fabric application, it had a stateless service, I set up the service with the standard code:

    `protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
    {
        return new ServiceInstanceListener[]
        {
            new ServiceInstanceListener(serviceContext =>
                new KestrelCommunicationListener(serviceContext, "ServiceEndpoint", (url, listener) =>
                {
                    ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting Kestrel on {url}");

                    return new WebHostBuilder()
                                .UseKestrel()
                                .ConfigureServices(
                                    services => services
                                        .AddSingleton<StatelessServiceContext>(serviceContext))
                                .UseContentRoot(Directory.GetCurrentDirectory())
                                .UseStartup<Startup>()
                                .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)
                                .Build();
                }))
        };
    }`

An exception was thrown in the startup class, and then the service fabric would repeatedly call the method "CreateServiceInstanceListeners" and the process didn't crash. The service fabric would continue to execute this method repeatedly without stopping.

Area/Component:
Reliable services

Expected behavior
I hope the service process stops or crash after a few times retry, Is there any mechanism to stop the service if an exception is thrown? Or set the retry times, after multi times, the service will crash.

Service Fabric Runtime Version:
Azure Service Fabric SDK: 6.0.1028.9590
Azure Service Fabric: 9.0.1107.9590

Environment:

  • Standalone
  • OS: Windows 11
  • target framework: net472

Assignees: /cc @microsoft/service-fabric-triage

@yshi1018 yshi1018 added the type-enhancement New feature or request label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant