Skip to content

Azure App Service on Linux seems to not perform graceful shutdown #2

@cmeeren

Description

@cmeeren

I have several ASP.NET Core APIs that run on Azure App Service on Linux. These applications perform important work on shutdown (using IHostApplicationLifetime.ApplicationStopping). This work takes just a couple of seconds to complete, so shutdown timeouts should not be relevant.

When I run the APIs locally and use Ctrl-C to shutdown the API, this work is performed correctly. However, when restarting the APIs in Azure, whether by deploying new versions or manually restarting the app service through the Azure Portal, the shutdown tasks seem to never run. It is almost as if Azure App Service just kills the container or process something when I click "Stop" or "Restart" in the Azure Portal.

Is this intended?

Note that this problem does not exist on Azure App Service for Windows. There, the shutdown work is performed correctly.

Possibly related:

dotnet/aspnetcore#18259

aspnet/AspNetCoreModule#115

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions