Remove After=foreman.target to fix systemd ordering cycles#432
Closed
pablomh wants to merge 1 commit intotheforeman:masterfrom
Closed
Remove After=foreman.target to fix systemd ordering cycles#432pablomh wants to merge 1 commit intotheforeman:masterfrom
pablomh wants to merge 1 commit intotheforeman:masterfrom
Conversation
After=foreman.target was added in 805217d to ensure systemctl stop foreman.target blocks until all constituent services fully stop, preventing a rapid stop+start race. However, every service is also WantedBy=foreman.target, making After=foreman.target inherently circular: foreman.target cannot finish starting until its Wants are satisfied, but those services cannot start until foreman.target has started. This caused both start and stop ordering cycles, which systemd resolved by dropping jobs — leading to unclean postgresql shutdowns, stale postmaster.pid files, and the very race condition the original fix was trying to prevent. Remove After=foreman.target from all services. Stop ordering is preserved through inter-service After= relationships: all application services are After=redis.service postgresql.service (reversed: redis/postgresql stop after all application services). PartOf=foreman.target ensures services stop when foreman.target stops, and systemctl stop foreman.target waits for the full PartOf-propagated transaction to complete. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
After=foreman.targetdependencies that were causing systemd ordering cycles during service startupTest plan
systemctl statusfor all affected services (candlepin, foreman, foreman_proxy, postgresql, pulp, redis)🤖 Generated with Claude Code