Skip to main content

App Not Responding

When your application is deployed but not serving requests, the issue is typically with the running container, port configuration, or resource exhaustion.

Debugging Steps

1. Check if the Container is Running

SSH into your server and verify the container status:

ssh app@<server-ip>
docker ps

Look for your application's container. If it is not listed, it has crashed or was stopped. Check docker ps -a to see stopped containers and their exit codes.

2. Check Application Logs

Go to Application > App Logs in the dashboard to see recent output from your application. Look for:

  • Stack traces or exception messages
  • "Address already in use" errors
  • Permission denied errors
  • Module import errors

3. Verify Port Configuration

Your application must listen on the port configured in Build Settings. The most common cause of 502 errors is a port mismatch.

Check:

  • The container_port in your build settings or appliku.yml
  • That your application binds to 0.0.0.0 (all interfaces), not 127.0.0.1 (localhost only)
  • That the PORT environment variable matches your app's listen port

4. Check Process Definition

Ensure your web process command is correct in the services section of your appliku.yml or in the Processes settings in the dashboard.

Common mistakes:

  • Typo in the command (e.g., gunciorn instead of gunicorn)
  • Missing module path (e.g., gunicorn wsgi instead of gunicorn project.wsgi)
  • Using a development server in production (e.g., python manage.py runserver)
warning

Do not use development servers (like Django's runserver or Flask's built-in server) in production. They are not designed for production traffic and may crash under load. Use Gunicorn, uWSGI, or similar production-grade servers.

Common Errors

Out of Memory (OOM Killed)

When a container exceeds available RAM, the Linux OOM killer terminates it.

Symptoms:

  • Container disappears from docker ps without an obvious error
  • dmesg | grep -i oom on the server shows OOM events
  • Application works initially but crashes under load

Solutions:

  • Reduce the number of worker processes (e.g., for Gunicorn: --workers 2 instead of the default)
  • Set memory limits for processes that tend to leak
  • Upgrade to a server with more RAM
  • Profile your application for memory leaks

Nginx 502 Bad Gateway

Nginx returns a 502 when it cannot connect to your application's container.

Common causes:

  • The application crashed and the container is not running
  • The application hasn't finished starting yet
  • Port mismatch between Nginx configuration and the container port
  • The application is listening on 127.0.0.1 instead of 0.0.0.0

Solutions:

  1. Check container status with docker ps
  2. Check application logs for startup errors
  3. Verify the container port in Build Settings matches what your app listens on
  4. Ensure your app binds to 0.0.0.0

Application Hangs on Startup

The application starts but never becomes ready to serve requests.

Common causes:

  • Blocking call during startup (e.g., trying to connect to a database that isn't available)
  • Loading a large ML model or dataset into memory
  • Deadlock in application initialization code

Solutions:

  • Add timeouts to database connections and external service calls during startup
  • Load large resources lazily (after the first request) instead of at boot time
  • Check logs for where the application gets stuck