Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Help for owners

My app on Render or Railway keeps restarting or crashing

Short answer

On Render a service is restarted after 60 seconds of failed health checks, and it also stops when it runs out of memory or exits on an error. Railway marks a deployment Crashed when the process stops. The usual causes are too little memory, a failing health check, or code that exits.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • The site goes down for a minute and comes back, again and again.
  • The dashboard shows Instance Failed or Crashed.
  • It started after I added a feature or more customers.
  • The deploy succeeds but the app never becomes healthy.
  • Exit code 137 or 139 appears in the logs.

Why does this happen?

  1. Health checks fail

    Render checks every running instance every few seconds. A check must answer within 5 seconds. After 15 seconds of consecutive failures it stops routing traffic to the instance, and after 60 seconds it restarts it. A slow page used as the check, or an app busy with one big job, can trigger this.

  2. Out of memory

    Render lists traffic spikes, steady memory leaks, a worker count set too high for Python or Ruby, and a Node.js heap limit above what the instance has as causes. Abrupt spikes may not show in the service metrics.

  3. The app does not listen where the platform looks

    A Render service that does not listen on a detectable port fails with a port scan timeout. The page says to bind to 0.0.0.0 and the PORT environment variable.

  4. The program exits

    Render explains exit codes: 0 means the app exited early, 2 a failed start command, 137 a forced kill often after failed health checks or CPU or RAM exhaustion, and 139 a segmentation fault.

  5. On Railway, a crashed process is marked Crashed

    Railway keeps a deployment Active until it crashes, then marks it Crashed. A deployment that exceeds its ephemeral storage limit can be forcefully stopped and redeployed, and Railway may redeploy for host migrations or platform upgrades.

What can I do about it today?

  1. Open the events and logsOn Render open the service's Events page and Logs. On Railway open the deployment and read the logs around the crash. Copy the last lines before each restart.
  2. Check memory at the time of the restartOn Render the Metrics view shows CPU and RAM. A graph that climbs and drops at each restart points to memory.
  3. Note any recent deploy or growthWrite down what changed before the restarts began: a new release, more users, a new scheduled job.
  4. Do not keep clicking restartRender says to avoid manually terminating or restarting a failed instance while troubleshooting, because it manages the instance lifecycle.
  5. Do not change the plan or delete the service blindlyA bigger plan raises the cost and does not fix a crash caused by a bug. Deleting the service loses its settings.

When should I bring someone in?

  • Customers are affected for minutes at a time.
  • The logs show a code error you cannot read.
  • Memory climbs steadily and there is no one to profile the code.

How do I handle it?

  1. Read the events in orderI put restarts, deploys and exit codes on one timeline to see what comes first.
  2. Separate platform kills from app exitsA health-check restart, an out-of-memory kill and a crash in the code look alike from outside. The exit code and the logs tell them apart.
  3. Fix the cause in the code or settingsPort binding, heavy start-up work, worker counts, leaks and slow health endpoints are corrected in the app.
  4. Give the health check a light jobThe check should be a quick route that does not depend on slow work.
  5. Release with a rollbackThe fix is deployed so it can be rolled back, and the restart count is watched afterwards.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Is it the platform's fault?

Sometimes, as Railway lists platform-initiated redeploys. Most repeating restarts trace to memory, health checks or the app exiting.

Why does it restart even though it looks fine?

A health check can fail while pages still load, for instance when the check route is slow or the app is busy.

Will upgrading the instance help?

Only for memory or CPU shortage. Check the metrics before paying for more.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.

For your developer: the technical fixes

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.