-
-
Notifications
You must be signed in to change notification settings - Fork 73
Handle stale pid file for crashing daemons #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4a53f61
service: clean stale pidfile after unclean daemon exit
troglobit 30f2ca3
service: log signal name and core dumps in death message
troglobit 309ad1b
sig: spell SIGUNKNOWN correctly
troglobit 3febc7d
test: regression for stale pidfile cleanup after unclean exit
troglobit 7d09e34
doc: document stale pidfile cleanup and new restart log
troglobit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/bin/sh | ||
| # Regression: Finit must remove a daemon-owned (pid:!) stale pidfile | ||
| # left behind by an unclean exit (SIGKILL), so the next instance can | ||
| # start. Simulates the dbus-daemon pattern: 'serv -x' refuses to | ||
| # start if its pidfile already exists. | ||
|
|
||
| set -eu | ||
|
|
||
| TEST_DIR=$(dirname "$0") | ||
| PIDFN="/run/serv.pid" | ||
|
|
||
| test_teardown() | ||
| { | ||
| say "Running test teardown." | ||
| run "rm -f $FINIT_CONF $PIDFN" | ||
| } | ||
|
|
||
| # shellcheck source=/dev/null | ||
| . "$TEST_DIR/lib/setup.sh" | ||
|
|
||
| say "Add service stanza '$FINIT_CONF' with pid:!$PIDFN" | ||
| run "echo 'service pid:!$PIDFN serv -np -P $PIDFN -x' > $FINIT_CONF" | ||
| run "initctl reload" | ||
|
|
||
| retry "assert_num_children 1 serv" | ||
| assert_is_pidfile "serv" "$PIDFN" | ||
|
|
||
| PID=$(texec cat "$PIDFN") | ||
| say "SIGKILL serv ($PID) -- leaves stale pidfile" | ||
| run "kill -9 $PID" | ||
|
|
||
| # Without the fix, 'serv -x' refuses to start on each retry until | ||
| # Finit hits restart_max and marks the service crashed. With the fix | ||
| # Finit removes the stale pidfile and the next instance comes up. | ||
| retry "assert_pidiff serv $PID" | ||
| retry "assert_num_children 1 serv" | ||
|
troglobit marked this conversation as resolved.
|
||
|
|
||
| sep | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.