Operations
A Service That Runs Fine May Still Be Unable To Start
Why long-running services can hide broken startup dependencies, and how to cold-start test DNS, credentials, mounts, discovery, and restart behavior before routine maintenance turns latent faults into outages.
- Reliability
- Operations
- nginx
- DNS
- systemd
- Incident Response
A green health check proves that a service is running now.
It does not prove that the service could start again.
That distinction sounds academic until a routine reboot turns a months-stable server into a hard outage. I recently had exactly that class of failure: the application process had been healthy for a long time, but a dependency required only during startup had quietly degraded. Nothing exercised that path until the machine rebooted.
The reboot did not create the fault. It revealed it.
That led me to a reliability rule I now think is worth testing explicitly:
Steady-state health and cold-start health are different properties.
Why long uptime can hide broken dependencies
Long-running processes cache more than people realize.
Depending on the application, steady state may be using:
- already-resolved DNS names;
- established database connection pools;
- cached credentials or tokens;
- already-mounted filesystems;
- warmed local caches;
- service-discovery results captured at startup;
- certificates loaded into memory;
- kernel state or network sessions that have existed for weeks.
If one of those upstream dependencies breaks later, the running process may continue happily.
The failure is latent.
Then something ordinary happens:
kernel update
↓
reboot
↓
service starts from zero
↓
startup-only dependency is exercised
↓
failure
The natural instinct is to blame the update because the outage began immediately afterward. That can be wrong. The update may only have forced the first clean start in months.
A concrete failure pattern: DNS at config load
A conventional nginx configuration with static upstream hostnames often resolves those names while loading configuration. If a required hostname cannot be resolved, nginx can fail configuration/startup rather than simply degrading one request path.
Imagine a reverse proxy with 12 distinct upstream hostnames. The box’s resolver is degraded such that a lookup requiring forwarding succeeds only 47% of the time.
A startup that needs all 12 lookups to succeed has approximate probability:
0.47 ^ 12 ≈ 0.0000001
In practical terms, the service is not “sometimes failing to start.” It is effectively unable to start.
A process that was already running could hide that condition indefinitely because it did not need to repeat those cold lookups.
That is exactly the kind of fault a normal HTTP health endpoint will never find.
Warm tests can lie too
Even when someone thinks to test DNS, the probe can accidentally test the cache instead of the dependency.
For example:
query the same hostname 20 times
may prove that a local cache can answer the same record 20 times. It may say very little about whether the resolver can successfully perform fresh upstream recursion.
To test the path you care about, force the path to be exercised.
For DNS forwarding, that can mean using unique names beneath a domain where NXDOMAIN itself is a valid response:
random-1.example.invalid-ish-zone
random-2.example.invalid-ish-zone
random-3.example.invalid-ish-zone
What matters is distinguishing a prompt authoritative negative answer from a timeout. A valid NXDOMAIN proves the recursive path completed; a timeout suggests the transaction did not.
The exact probe depends on the system, but the rule is general:
Do not let a cache answer a test whose purpose is to verify the thing behind the cache.
Startup dependency inventory
For every service important enough to page someone, I want a short inventory of what must work before the process can become healthy.
A useful table looks like this:
| Startup dependency | What failure looks like | Cold-start probe |
|---|---|---|
| DNS | unresolved upstream/config parse failure | fresh uncached resolution |
| Database | connection refused/auth failure | new connection using service identity |
| Secrets manager | missing credentials | fresh secret retrieval |
| Remote filesystem | mount timeout/path absent | remount in isolated test |
| OIDC/JWKS | auth subsystem cannot initialize | fresh discovery/key fetch |
| Service discovery | no endpoints | new registration/discovery cycle |
| Certificate/key files | process refuses config | validate from disk, not memory |
| Local writable paths | permission or disk failure | create/write/remove test artifact |
Do not stop at “network” or “database.” Write down the particular startup transaction.
That makes the test executable.
Test the service manager, not just the process
The second half of the incident pattern is what happens after a startup failure.
A service can fail for thirty seconds because a dependency is temporarily unavailable. Whether that becomes a thirty-second problem or an eleven-hour outage depends on the supervisor.
With systemd, inspect the unit’s restart semantics:
systemctl cat your-service.service
systemctl show your-service.service \
-p Restart \
-p RestartUSec \
-p StartLimitIntervalUSec \
-p StartLimitBurst
Questions worth answering:
- Does the service retry after a startup failure?
- Which exit conditions trigger a restart?
- Is there backoff?
- Can rate limiting permanently stop retries?
- Does another unit depend on it?
- Does boot continue while this service is dead?
- Will monitoring notice the failed unit even if the host itself is healthy?
Do not blindly add Restart=always to everything. Some failures should stop and demand intervention, and aggressive retries can amplify a dependency outage.
But the behavior should be intentional.
“systemd tried once and never again” is a dangerous default to discover during an incident.
A host health check is not a service health check
Another common trap is proving the wrong layer.
During an ingress outage, all of these may be true at once:
host responds to ICMP ✓
SSH works ✓
CPU looks fine ✓
memory looks fine ✓
Internet uplink works ✓
web service is listening ✗
Ping proves ICMP. It does not prove DNS, TLS, nginx, the database, or your application.
Likewise, a response from a CDN or access gateway may not prove the origin was touched at all. An edge-generated authentication redirect or WAF response can look like “the site responded” while the origin remains completely unavailable.
Design probes that force traffic through the layer you are validating.
Watch error transitions during incidents
A failure can change shape while you are debugging it.
In one incident, the initial condition was an unreachable host. Later, the host returned but the service on it remained down. The external error changed accordingly—but the investigation continued operating on the old hypothesis for too long.
This gives a useful incident-response trigger:
When the externally observed failure mode changes, explicitly rebuild the hypothesis tree.
Do not treat a new error code as cosmetic.
For an edge-proxied web service, distinguish states such as:
host unreachable
host reachable, port closed
TCP accepted, application hangs
application responds with error
edge blocks before origin
Each state eliminates different branches of the problem.
The best incident notes preserve the timeline of state transitions, not just the final root cause.
Add a cold-start canary
If the environment supports it, the strongest test is not another steady-state probe. It is periodically proving that a clean instance can initialize.
Options include:
- restart a disposable replica and wait for readiness;
- boot an isolated copy from the same configuration;
- run the application’s initialization/config parser in a clean container;
- establish new database/auth/DNS sessions without reusing pools;
- run a deployment smoke test that starts from an empty local cache;
- periodically restore a service into a temporary environment.
The test does not need to impact production traffic.
Its purpose is to exercise the dependency graph that normal uptime avoids.
Make unattended reboot a test case
A particularly useful acceptance test is:
If this machine reboots at 3:00 AM with nobody logged in, will every critical service recover by itself?
That question exposes assumptions around:
- encrypted disks requiring manual unlock;
- mounts and network ordering;
- DNS availability during boot;
- expired credentials;
- service-manager retry behavior;
- containers that were started manually;
- firewall rules applied by an interactive script;
- applications that require one successful external lookup before they can listen.
If maintenance automation can reboot the machine automatically, recovery should not depend on a person remembering an undocumented command.
A pre-reboot checklist that catches latent failures
Before rebooting an important host, especially one with unusually long uptime:
- Validate configuration from disk, not from the running process’s memory.
- Perform fresh DNS lookups for every boot-critical hostname.
- Verify new database connections using the service identity.
- Retrieve credentials through the actual secrets path.
- Check certificate validity and on-disk permissions.
- Verify required mounts can be established from scratch.
- Inspect service-manager restart and dependency behavior.
- Confirm monitoring alerts on “host up, service failed.”
- Identify anything initialized manually since the last boot.
- Have a console/recovery path if boot itself fails.
For a reverse proxy, I would go further and build a small script that extracts configured upstream hostnames and verifies each of them from a cold DNS path before rebooting.
For other systems, the same idea applies: derive the startup dependency list from configuration where possible instead of maintaining it only in prose.
Steady state is only half the system
Operational confidence tends to accumulate with uptime: “It has run for three months, so it must be stable.”
Long uptime can mean the opposite for startup reliability. It can give latent faults more time to accumulate behind caches and persistent sessions while reducing how often the cold path is exercised.
A service is not fully healthy until you know two things:
Can it keep running?
Can it start again?
Monitor the first continuously.
Test the second deliberately.