Configuration worker destructively rewrites the source config file, and the queue adapter is built before the persisted config is re-applied — engine silently degrades to the in-memory queue on every container restart
Version: engine 0.21.4 (behaviour introduced in 0.21.x with the always-on configuration worker; also present at least since 0.21.0)
Summary
Two independent behaviours combine into a silent, data-losing failure that only manifests on the second boot of the same filesystem:
The configuration worker rewrites the user's config file in place, destructively. On first boot it migrates each schema-registering worker's
config:block out of the YAML passed to--configand into./config/<worker-id>.yaml, replacing the block in the original file with a one-line pointer comment. In-block comments are destroyed. Our production config goes from 344 lines to 63 lines — the entireiii-queueblock, includingadapter: {name: rabbitmq, config: {amqp_url: ...}}, is gone from the file.On the next boot, the queue module is built from that (now gutted) YAML before the persisted store is applied, and is never rebuilt. Timings from our boot logs:
T+0.249s— queue module constructed; no adapter found in the YAML → falls back to the builtin in-memory adapter; consumers start on it.T+0.255s— persisted configuration from./config/iii-queue.yamlapplied. The adapter object already exists and is not reconstructed.
Net effect: zero AMQP connections. The engine reports healthy, consumers are registered, jobs are accepted — and every enqueued job goes into a process-local in-memory queue that is lost on the next restart.
Why this is severe
The failure is invisible in the two places an operator looks:
- The engine starts cleanly and the health endpoint returns OK.
- Behaviour differs by restart mechanism, which nobody thinks to vary:
- Recreating the container (deploy) → fresh image layer → pristine YAML → RabbitMQ works.
docker restart/ host reboot → same writable layer → gutted YAML → silent in-memory fallback.
We run the engine in a container with no volume on the app directory. Our unattended-upgrades window reboots the host at 04:30. Every such reboot killed our entire ingestion pipeline until the next deploy happened to recreate the container. It took two production outages (2026-07-20 and 2026-07-29) and a live inspection of the running container to find, because the YAML in git and in the image was correct — only the copy inside the running container's writable layer was gutted.
Reproduction
# 1. Start the engine with a config declaring the rabbitmq queue adapter
iii --config iii-config.production.yaml
wc -l iii-config.production.yaml # 344 -> 63 after boot
grep -c 'name: rabbitmq' iii-config.production.yaml # 1 -> 0
ls config/ # iii-queue.yaml et al. now exist
# 2. Restart the SAME filesystem (do not recreate it)
iii --config iii-config.production.yaml
# -> queue adapter is builtin/in-memory; no AMQP connection is opened.
# RabbitMQ shows zero consumers. No warning is logged.Step 2 is the container restart / host reboot case. It does not reproduce if you reset the file between runs — which is exactly why a deploy-based workflow masks it.
Expected behaviour
Any one of these would have prevented the outage; (1) and (2) are the ones we would most like to see:
Do not rewrite the user's
--configfile. Treat it as read-only input and seed the store from it without mutating it. If migration must be recorded, write a marker into./config/, not into the source of truth. A config file under version control that the runtime silently edits in place is surprising in itself; destroying the in-block comments makes it lossy.Build adapters after the persisted configuration is applied, or rebuild/re-resolve the adapter when the configuration worker applies a value that changes it. The 6ms ordering window is the actual defect — the correct configuration is present on disk and is loaded, just 6ms too late to matter.
Fail loudly instead of silently degrading. Falling back from a declared durable adapter to an in-memory one is a data-loss-grade downgrade. It should be an error, or at minimum a
WARN-level log naming both the declared and effective adapter. Today there is no log line at all distinguishing the two boots.If the destructive rewrite is intentional and load-bearing, please document it prominently under deployment/containers, including the deploy-vs-restart distinction — the current docs give no hint that a restart behaves differently from a redeploy.
Related question
${VAR} / ${VAR:default} placeholders appear to be frozen as resolved at seed time into the persisted store, and the store then wins over the YAML. This means a credential/endpoint rotation delivered through the environment does not take effect on restart, only on a fresh filesystem. Is that intended? It compounds the above: after the first boot, neither the YAML nor the environment is authoritative any more, and there is no obvious operator-facing way to tell.
Our workaround (for anyone hitting this)
At image build time we snapshot the tracked YAMLs to a root-owned read-only path outside the app tree, and in the container entrypoint — which re-runs on every start, including docker restart — we restore them and delete config/iii-*.yaml before exec'ing the engine. This makes every boot re-seed from config-as-code plus the current environment. Happy to contribute a docs note if useful.
Source: iii-hq/iii