Skip to content

Commit

Permalink
watchfrr: force kill daemons on restart
Browse files Browse the repository at this point in the history
Today, watchfrr sends a SIGSTOP to a misbehaving daemon through
frrcommon. The issue is, a stuck daemon (like in a thread starvation
situation) will not honor a SIGSTOP, and watchfrr will try indefinitely
to kill it.

Let's not waste time and kill -9 from the get go.

Signed-off-by: Tuetuopay <[email protected]>
  • Loading branch information
Alexis Bauvin committed Oct 18, 2024
1 parent ba60b39 commit 5e0d6d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions tools/frrcommon.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ daemon_stop() {
return 1
fi

debug "kill -2 $pid"
kill -2 "$pid"
[ "$2" = "SIGKILL" ] && signal=-9 || signal=-2

debug "kill $signal $pid"
kill "$signal" "$pid"
cnt=1200
while kill -0 "$pid" 2>/dev/null; do
sleep .1
Expand Down
2 changes: 1 addition & 1 deletion watchfrr/watchfrr.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#define DEFAULT_MAX_RESTART 600
#define DEFAULT_OPERATIONAL_TIMEOUT 60

#define DEFAULT_RESTART_CMD WATCHFRR_SH_PATH " restart %s"
#define DEFAULT_RESTART_CMD WATCHFRR_SH_PATH " restart %s SIGKILL"
#define DEFAULT_START_CMD WATCHFRR_SH_PATH " start %s"
#define DEFAULT_STOP_CMD WATCHFRR_SH_PATH " stop %s"

Expand Down

0 comments on commit 5e0d6d6

Please sign in to comment.