-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Fix the race when monit is used to monitor services which are also #8931
Conversation
@@ -40,6 +40,10 @@ DAEMON_USER=root | |||
# | |||
do_start() | |||
{ | |||
# Avoid race at boot time when both monit and init.d start the service | |||
PID=$(ps -ef | grep $DAEMON | grep -v grep | awk '{print $2}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is pidof
not available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought pidof here reports a wrong pid in this case. Just checked it, actually pidof does scan /proc and find matching name. Will update it.
Thanks Dawn! |
# Avoid a potential race at boot time when both monit and init.d start | ||
# the same service | ||
PIDS=$(pidof $DAEMON) | ||
for PID in "${PIDS}"; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't want this quoted, else it treats it as a single string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, same mistake again. Fixed. Thanks for catching this, and luckily we only have one for each daemon here. :-(
started at boot time via init.d at boot time.
LGTM, thanks @dchen1107! |
Fix the race when monit is used to monitor services which are also
started at boot time via init.d at boot time.
Fixed #8742
I ran e2e tests earlier this morning, but failed due to e2e current breakage. I manually tested this on machine without current patch, manually running service kubelet start (not restart) will reproduce binding issue reported in #8742
cc/ @vmarmol @roberthbailey