# Instance or service not restarted when I expected it to

**URL:** <https://community.fly.io/t/instance-or-service-not-restarted-when-i-expected-it-to/6155>\
**Category:** Questions / Help\
**Created:** [July 25, 2022, 8:01pm UTC](https://community.fly.io/t/instance-or-service-not-restarted-when-i-expected-it-to/6155 "2022-07-25T20:01:55Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![greg](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/greg/32/2119_2.png) [@greg](https://community.fly.io/u/greg)\
**Post date:** [July 25, 2022, 8:17pm UTC](https://community.fly.io/t/instance-or-service-not-restarted-when-i-expected-it-to/6155/2 "2022-07-25T20:17:45Z")

</div>

This _may_ not be the case here (as it shows as pending) however I found that when my app randomly failed (in my case a random spike but would be the same for memory) they did _not_ get restarted. I too was expecting they would have.

> [@Any thoughts on why my app randomly died?](https://community.fly.io/t/any-thoughts-on-why-my-app-randomly-died/4427):
>
> Hello, I happened to notice one of my dev web apps (nodejs) stopped responding earlier today. I haven’t touched it for days. Last deploy a week ago, ish. It is behind Cloudflare’s orange-cloud proxy and so all requests to it from its domain currently return a 525. But as I’ve found in the past, that status code is misleading. It’s not an “SSL” error. That is just what Cloudflare returns if it can’t get a response back from the app. Sure enough: Instances ID PROCESS VERSION REGION DESIRE…

The fix was simple: add a healthcheck to your `fly.toml` (tcp and/or http, depending on your app) _and_ make sure that has a `restart_limit` set. Since the default is 0. Which disables restarts:

> - `restart_limit`: The number of consecutive TCP check failures to allow before attempting to restart the VM. The default is `0`, which disables restarts based on failed TCP health checks.

See:

> **[Fly Launch configuration (fly.toml)](https://fly.io/docs/reference/configuration/#services-tcp_checks)**
>
> Documentation and guides from the team at Fly.io.

Upping the RAM to 4GB will also fix it. Just a more expensive way 🙂

---

_[View the full topic](https://community.fly.io/t/instance-or-service-not-restarted-when-i-expected-it-to/6155)._
