ArturSymanovic-4549 avatar image
2 Votes"
ArturSymanovic-4549 asked

Azure Container Instance randomly failing. How to troubleshoot?

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:

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:

killing.png (5.9 KiB)
cpu-usage.png (15.1 KiB)
memory-usage.png (12.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers