Troubleshoot common exit code issues in Azure Spring Apps

Note

The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.

The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps.

This article describes troubleshooting actions you can take when your application in Azure Spring Apps exits with an error code. You may receive an error code if your application deployment is unsuccessful, or if the application exits when it's running.

Exit codes

The exit code indicates the reason the application terminated. The following list describes some common exit codes:

  • 0 - The application exited because it ran to completion. Update your server application so that it runs continuously.

    Deployed Azure apps in Azure Spring Apps should offer services continuously. An exit code of 0 indicates that the application isn't running continuously. Check your logs and source code.

  • 1 - If the application exits with a non-zero exit code, debug the code and related services, and then deploy the application again.

    Consider the following possible causes of a non-zero exit code:

    • There's something wrong with your Spring Boot configuration.

      For example, you need a spring.db.url parameter to connect to the database, but it's not found in your configuration file.

    • You're disconnected from a third-party service.

      For example, you need to connect to a Redis service, but the service isn't working or available.

    • You don't have sufficient access to a third-party service.

      For example, you need to connect to Azure Key Vault to import certificates in your application, but your application doesn't have the necessary permissions to access it.

  • 137 - The application is terminated immediately by the hosting platform with no grace period. This exit code can be the result of one of the following scenarios:

    • When the liveness check fails, the hosting platform immediately kills the application after attempting to terminate it and waiting for a grace period. Ensure that your application handles graceful shutdown correctly.

    • The application exited because of an out-of-memory error. The application requested resources that the hosting platform failed to provide. Update your application's Java Virtual Machine (JVM) parameters to restrict resource usage or to scale up application resources.

      If the application is a Java application, check the JVM parameter values. They may exceed the memory limit of your application.

      For example, suppose you set the Xmx JVM parameter to 10 GB, but the application is using up to 5 GB of memory. Decrease the Xmx value or increase the application memory to make sure that the value of the Xmx parameter is lower or equal to the memory limit of the application.

  • 143 - The application exited because it failed to respond to a health check due to an out-of-memory error or some other error.

    This error code is most often generated by an out-of-memory error. For more information, see App restart issues caused by out-of-memory issues.

    You can also get details from the application log by using the Azure CLI az spring app logs command. For more information, see Stream Azure Spring Apps application console logs in real time.

Next steps