Background worker stops processing after a connection interruption

Hey everyone,

We’ve occasionally had background jobs stop processing on Fly. The worker machine still shows as running, but tasks pile up in Redis until we manually restart it.

Our latest incident happened on October 16, when Fly reported platform-wide host reboots. We’re unsure whether the two are connected.

We also have a standby machine, but it doesn’t seem to take over in this situation.

Has anyone experienced something similar? Could a Fly host/network interruption trigger this, and should our worker automatically reconnect afterward?

Would appreciate any guidance from the Fly team or others who’ve experienced this

Hi… Something like an inability to reach the Redis server wouldn’t have triggered the standby Machine, but if the underlying physical host stopped being reachable from the rest of Fly.io’s infrastructure, then that would generally cause it to step in. The exact rules for the standby Machines unfortunately aren’t really documented; the following forum post from June has the fullest description that I’ve seen to date…

https://community.fly.io/t/standby-machine-what-happens-to-the-original-machine-when-its-host-recovers-after-failover/27995/4

Possibly the standby mechanism was intentionally disabled during the rolling reboots, to avoid further straining the system, :thinking:. (They mentioned in the gru mega-thread that they were already short on capacity.)

The official docs do have some brief suggestions on monitoring background workers in general, however:

https://docs.fly.io/reference/health-checks#health-checks-for-apps-with-no-services

In the case of the fleet-wide reboots… If the Machine wasn’t set to auto-suspend, then it should have gone through it’s own, full boot cycle when the host rebooted. (However, the status page entry did mention a special case when the Machine’s restart policy was set to a non-default value, now that I think of it.)

When it’s just a glitch in network connectivity to Redis (or similar), then it depends on the particular implementation of that background worker. The Python-based ones anecdotally do seem a little prone to hanging, although I don’t know that ecosystem very well.

https://community.fly.io/t/celery-beat-process-hangs-silently-after-several-hours/25444

You can look at the worker’s own logs (fly logs and/or Grafana) to see if there are any complaints about network, OOMs, timeouts, etc.

Hope this helps a little!

Thanks, this helps clarify the standby behavior!

The main concern is that the worker looks fine, but jobs stop processing. This has happened a couple of times over the past few months and disrupted important operations. Is there a simple way to catch this early and get it working again automatically? What do others usually do?

this is highly dependent on the job processing service you’re using as well as your app’s stack; there isn’t a generic Fly way to do this. if you post more details about your app, someone might be able to point you in the right direction.

We’re using Django with Celery 5.6.2, Kombu 5.6.2, Redis as the broker, and a separate Beat scheduler. The worker uses the gevent pool.

After a Redis connection interruption, the worker still appears running but stops processing jobs. Beat continues scheduling them. Redis becomes reachable again, but the worker needs a manual restart before processing resumes.

Reconnection is already enabled:

broker_connection_retry=True

broker_connection_retry_on_startup=True

broker_connection_max_retries=100

The worker logged “Connection to broker lost” followed by “Timeout reading from socket.”

This has happened a couple of times over the past month and disrupted important operations.

It’s much more similar issue which is mentioned in this thread.