Why does my app keep restarting on App Platform?

Apps unexpectedly restarting is usually caused by high memory usage, high disk consumption, or an application inside of the container crashing and causing the container to exit. Use the following methods to troubleshoot why your app might be restarting.

Container Exiting

To diagnose if an app is restarting due to container exiting, review the app’s runtime logs for any errors that might be linked to the container crashing. To review the runtime logs in the control panel, navigate to your app’s overview page and then click the Runtime Logs tab. The runtime log displays any errors, warnings, and other information being emitted from applications running in the container.

If your app is emitting errors before crashing, you may need to troubleshoot the code in your app to keep it from triggering a restart.

High Memory Consumption

Sometimes apps can consume too much memory and cause the container to crash.

To diagnose whether an app is restarting due to high memory consumption, navigate to your app’s overview page, click the Insights tab, and review the Memory graph. If the app is consuming 100% or near 100% of its allotted memory before restarting, the app is likely crashing due to memory issues.

Sometimes the app may be consuming memory faster than the Memory graph can update, causing the app to crash and restart several times in quick succession with no clear reason. This can make diagnosing the problem more difficult as the app’s runtime metrics are refreshed with each restart. If your app is crashing almost immediately after a restart and isn’t throwing any runtime errors, it is likely experiencing memory issues.

If the app is meant to consume more memory than the amount allotted by your app’s plan, update the plan in the app’s Settings tab to include more memory. If the app is consuming more memory than it is meant to, you may need to troubleshoot the app’s code for memory leaks.

High Disk Usage

The local disk space on a host instance running a container is ephemeral and limited to 2 GiB. If the disk is filled to capacity, App Platform detects the container as unhealthy and restarts it. We recommend using the app’s available disk storage only as temporary storage.

While App Platform does not currently collect and display metrics related to disk usage, this problem usually occurs when a user uploads files that are too large for the container’s disk. If your app is restarting during or directly after a large file upload to the container, this is likely the cause of the app restarts. If this is the case, you may have to reconfigure the app to use smaller files.