Search code examples
azureazure-service-fabricservice-fabric-stateless

Are there scenarios where a Service Fabric Service is torn down but the host process is reused?


I am troubleshooting an issue where a service dependency is created in the Program.cs and passed into the Service Class. (for more context this is a stateless service, but my question applies for both) This services RunAsync method uses the CancellationToken supplied to determine if the service is still running. If the token gets cancelled then it calls dispose on the dependency. The symptom that I am diagnosing is that on start up sometimes the dependency is not initialized. I am pretty sure I read in the docs somewhere that the host process in some scenarios may be reused and not torn down when a service instance is torn down, but I can't seem to find it now.

Does the Host process outlive, and rehost new service instances in Service Fabric?


Solution

  • As far as I get it, if you have any replica around the process won't shut down. If there are no replicas left, the process will be closed after a grace interval.

    See these discussions for more information - Processes keep running after service is deleted and Processes still keep running after Service Fabric App is removed.