﻿# An active exited oneshot unit is not a live inference worker

An active exited oneshot unit is not a live inference worker. A focused service-reliability guide with the documented mechanism, a reproducible validation scenario, evidence and operational limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/sre-oneshot-remainafterexit-completion/
Language: en

A deployment can show a green unit after a preparation script has finished and every process has exited. That may be exactly right for a one-time setup task. It is misleading when the same status is presented as proof of a live model server. Type=oneshot and RemainAfterExit describe completed activation, not continuing inference execution.

## The service-manager contract

For oneshot, systemd waits for the start process to exit before considering activation complete and proceeding with follow-up units. RemainAfterExit=yes can keep the unit active after its processes have exited. Without it, a completed oneshot normally does not remain in the active state. Multiple ExecStart commands are permitted for this type and run sequentially, with failures affecting whether later commands execute. None of these rules creates a persistent inference worker.

## Implementation details

Separate installation or artifact preparation from the long-running serving unit. Define what a successful setup command establishes, such as writing a validated local configuration, and what it explicitly leaves for the server to verify. Do not use a retained active state as a heartbeat. Record unit type, substate, main-process identity where relevant, and the functional check for the actual endpoint. Review whether repeating setup is necessary after a model or mount change.

## A constructed validation case

Create a setup fixture that writes a harmless marker and exits successfully. Compare oneshot with and without RemainAfterExit, observing process absence alongside unit state. Start a separate test server only in a controlled branch and verify that the setup marker can exist while that server is unavailable. Add a failing early command before a later marker-writing command to inspect sequential failure handling. Preserve command results rather than interpreting every inactive state as a failed setup.

## Recovery limits

An active exited setup unit is legitimate evidence only for its declared setup contract. It does not guarantee the marker still matches current artifacts, the storage is healthy or the endpoint remains reachable. Choose separate observations for those claims. Stopping and reactivating the setup unit may have application-specific side effects, so a recovery procedure must not blindly replay preparation merely to change the dashboard state. Test idempotence separately when replay is intended.

## Primary references

[systemd systemd.service documented interface](https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html); [systemd systemd.unit documented interface](https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html).

This is a proposed service-lifecycle validation, not an executed Retrivium benchmark. Preserve the implementation version and unresolved outcomes; interface documentation does not establish the availability or correctness of an inference service.

## Related reading

[Startup, readiness and liveness for a slow-loading model server](/journal/provider-startup-readiness-liveness-separation/); [Golden inference API fixtures: test the contract rather than prose](/journal/provider-golden-contract-fixtures/).
