Azure Container Instance randomly failing. How to troubleshoot?

Artur Symanovic 21 Reputation points
2021-02-11T16:05:23.44+00:00

I am running .NET 5 application (with NGINX as a reverse proxy) using Azure Container Instances (Linux).
The container instance randomly fails sometimes after a week, sometimes agter couple of hours without any logs.

The only thing that I get is the following in the events tab on Azure Portal:
67026-killing.png

The logs tab on Azure Portal, where the output and errors of my "dotnet run" command are usually shown nothing indicates any errors.

Can someone advice please on how to troubleshoot further as I have ran out of ideas?

This is what I have tried so far:

In the startup script (that is run as entry point in my "CMD" command in Docker file) I have added the line that captures the exit code of dotnet application:

        service nginx start  
        dotnet /app/API.dll  
        echo "dotnet exited with code" $?  

When the container fails the "dotnet exited with code" part is never reached.

----------

In my .NET application I have added code to log all errors and exceptions to Azure SQL Database. Additionally I have added code to log custom message to the same database when application closes (OnShutDown lifehook event). - There is nothing logged into database when the failure happens.

----------

I have also used azure cli to monitor logs with the "az container attach" command and left my PC to monitor for couple of days. When issue happened, nothing was reported to console...

----------

Finally when I look at the CPU and Memory graphs in Monitor - the amount of CPU and RAM resources used are very low and never reach even 50% of what is allocated at the time of failure:
67044-cpu-usage.png
67045-memory-usage.png

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
687 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.