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.
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?
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.
Confirmed by render.com
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.
Confirmed by render.com
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.
Confirmed by render.com
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.
Confirmed by render.com
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.
Confirmed by docs.railway.comTechnical detail: A Docker container keeps restarting and never stays up
What can I do about it today?
- 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.
- 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.
- Note any recent deploy or growthWrite down what changed before the restarts began: a new release, more users, a new scheduled job.
- Do not keep clicking restartRender says to avoid manually terminating or restarting a failed instance while troubleshooting, because it manages the instance lifecycle.
- 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?
- Read the events in orderI put restarts, deploys and exit codes on one timeline to see what comes first.
- 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.
- 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.
- Give the health check a light jobThe check should be a quick route that does not depend on slow work.
- 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
docker ps shows an uptime of a few seconds that never growsA Docker container keeps restarting and never stays upError R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launchHeroku kills a Node.js app that does not bind to $PORT in timeFATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memoryFATAL ERROR: heap out of memory during a webpack or npm build