fix *arr rootfolders oneshot racing app startup - #286
Merged
kiriwalawren merged 1 commit intoAug 1, 2026
Conversation
<serviceName>-rootfolders is the only API reconciler that adds nixflix.serviceDependencies to its after/requires, so it can be restarted independently of <serviceName>-config.service — for example when one of those mounts is remounted, which propagates a restart to every unit requiring it. <serviceName>-config.service is Type=oneshot RemainAfterExit=true and does not require serviceDependencies, so in that case the wait-for-api it owns does not re-run and nothing waits for the app: the reconciler's first `curl -Sf $BASE_URL/rootfolder` hits a closed port and set -e kills the oneshot with curl's exit 7, which systemd reports as 7/NOTRUNNING. The root folders are then never reconciled, and the failed unit is left for the next activation. Gate the unit on the API itself with the same ExecStartPre already used by <serviceName>-config.service, and cover the race in the full-stack VM test by restarting each *arr service together with its rootfolders reconciler.
Owner
|
Good catch! Thank you so much for the PR! |
Contributor
Author
|
thank you for this sweet flake! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, ran into a problem where I changed my mounts and the service came up before the mounts did. Noticed ´mkWaitForApiScript´ already exists, just isn't used for the root folders.
Disclaimer: change was assisted by LLM. Full report/testing below
Report
<serviceName>-rootfoldersis the only API reconciler that addsnixflix.serviceDependenciesto itsafter/requires, so a remount of one of those mounts propagates a restart to it while<serviceName>.serviceis still coming back up.<serviceName>-config.serviceisRemainAfterExit=trueand doesn't require those deps, so thewait-for-apiit owns doesn't re-run — the reconciler's firstcurl -Sf $BASE_URL/rootfolderhits a closed port andset -ekills the oneshot with exit 7.Testing
Local
nix build .#checks.x86_64-linux.<check>on x86_64-linux, flake.lock unchanged:full-stack,sonarr-basic,radarr-basic,lidarr-basic,sonarr-anime-basic,unit-tests,formatting— all pass.With
modules/arr-common/rootFolders.nixreverted to main and the new full-stack stepkept, the test fails with the reported signature:
With the fix, all four *arr services reconcile after a restart racing app startup:
Not run locally: jellyfin/prowlarr/seerr/maintainerr/qbittorrent/sabnzbd/recyclarr basics,
the caddy/nginx/postgresql/vpn integration tests, docs-build — none instantiate
rootFolders.nix.