Skip to content
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

Merged
merged 1 commit into from
May 29, 2015

Conversation

dchen1107
Copy link
Member

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

# ps -ef | grep kubelet
root      5609     1  1 17:38 ?        00:00:12 /usr/local/bin/kubelet --api_servers=https://kubernetes-master --cloud_provider=gce --config=/etc/kubernetes/manifests --allow_privileged=False --v=2 --cluster_dns=10.0.0.10 --cluster_domain=cluster.local --configure-cbr0=true --cgroup_root=/

# service kubelet start
[ ok ] Starting The Kubernetes container manager: kubelet.

# ps -ef | grep kubelet
root     16737     1  9 17:56 ?        00:00:01 /usr/local/bin/kubelet --api_servers=https://kubernetes-master --cloud_provider=gce --config=/etc/kubernetes/manifests --allow_privileged=False --v=2 --cluster_dns=10.0.0.10 --cluster_domain=cluster.local --configure-cbr0=true --cgroup_root=/

cc/ @vmarmol @roberthbailey

@vmarmol vmarmol self-assigned this May 28, 2015
@@ -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}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is pidof not available?

Copy link
Member Author

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.

@roberthbailey
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Member Author

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.
@vmarmol
Copy link
Contributor

vmarmol commented May 28, 2015

LGTM, thanks @dchen1107!

@vmarmol vmarmol added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2015
rjnagal added a commit that referenced this pull request May 29, 2015
Fix the race when monit is used to monitor services which are also
@rjnagal rjnagal merged commit 6274d84 into kubernetes:master May 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

monit tries to run second instance of kubelet every 2 minutes after reboot (?)
5 participants