Skip to content

Host Reboots Need the Same Proof of Recovery as Deployments

A Stack Overflow Blog author argues that a rebooted host should be verified by a completed job, not just a running process. A small Python rehearsal shows how queue records can disagree after a restart.

4 min readBased on 1 source27 views

TL;DR

  • A service that came back after a host reboot is not proven healthy until it completes one real job on that host.
  • Kernel changes and reboots can alter the environment in ways application code tests never cover, and Ubuntu's new kernel cadence means more restarts to plan.
  • Process checks, mount dependencies and rollbacks do not settle whether work finishes correctly; the queue record of a completed job does.

Reboots are deployments in disguise

Teams often treat a host restart as routine maintenance because the application code has not changed. The check afterwards is usually whether the service came back up. Stack Overflow Blog contributor argues that this bar is too low. A reboot can bring back a different kernel, remount volumes and restart the other services the application depends on, in an order the last deployment never tested.

The pace of kernel updates makes this more pressing. Canonical has moved Ubuntu to overlapping two-week cycles, so a new kernel ships every week. A new kernel only takes effect after a reboot, so each one brings another restart to plan. Canonical's Livepatch can apply some critical and high-severity fixes without a restart, but it covers only particular kernel combinations, and after 9 to 13 months of patches for a given kernel, Canonical advises updating and restarting.

A rehearsal of a queue-backed export service

The author describes a team running an export service on two Linux hosts, each with one worker. A worker takes a job from a shared queue, writes the file to a volume on its host and marks the job done. A job counts as complete only when both steps have happened.

To see what an operator would observe during a reboot window, the author built a small single-machine rehearsal with two Python worker processes sharing a SQLite database that stands in for the queue. The harness has no real export files. Worker A claimed job J-001, was drained so it stopped taking new work, and put J-001 back in the queue with no owner before it was stopped. While A was offline, worker B claimed and finished J-002.

When A returned, its process reported as up, which a basic health check would accept. Its claim gate, however, found that a marker file on the volume was missing and reported a dependency as unavailable, so it refused J-001. Once the marker was restored, A claimed and completed J-001. Only that completed row showed that the returned worker had done its work.

The author notes that this rehearsal is narrow. It involved no real mount, bootloader or kernel, and it does not test capacity. Its value is in showing that three records can disagree after a restart: the process was running, the dependency was missing, and no job had finished.

Making startup checks meaningful on systemd

On a Linux host, systemd can narrow the gap between these records. The RequiresMountsFor= directive makes a unit depend on the mount units for the paths it needs, so the worker waits for its volume. Setting Type=notify keeps the service in the starting state until the worker sends READY=1. The default Type=simple counts a service as started once its process is forked, and the systemd manual warns that systemctl start can report success even when the binary cannot be run.

Even so, these settings only tell the host that something is mounted and that the worker says it is ready. Whether the worker can take a job and record it as finished remains an application question, best answered by one representative job.

Rollbacks do not undo completed work

Booting the previous kernel is not the same as rolling back the application's work. The author simulated a process restart in the rehearsal, and the queue kept J-001 marked done by A and J-002 done by B, since committed transactions survive a relaunch. On a real host, a previous kernel does not restore packages upgraded in the same window, the queue, exports already on the volume, or anything sent to other systems. If recovery replays jobs and the application cannot recognize a job it already finished, an export could run twice and leave a duplicate file.

Why it matters

For developers and operators, a reboot should be followed by a check that a real unit of work completes on the returned host, and the result should be recorded where someone can read it. The author recommends writing the requeue decision into the plan before a worker is stopped, since handing a job back, finishing it first or waiting for a lease to expire each change when and how the job runs again. Ownership should also be explicit: the person who runs the hosts confirms the machine and its dependencies came back, while the service owner sends a known job and decides when normal intake resumes. Teams that run their own bare-metal servers hold both roles, which makes clear ownership of the reboot and the acceptance test even more important.

Sources

This article was written by Blozhik from the reporting below. Read the originals for full detail.

StA Reboot Is Still a DeploymentStack Overflow Blog
Was this useful?

Keep reading

Discussion · 0

Sign in to join the discussion. Liking does not need an account.Sign inRegister
Loading comments…
blozhikDeveloper news from across the web, explained. Every story links to its original sources.