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

broken awk causes infinite agent loop #306

Open
vdloo opened this issue Jan 25, 2018 · 0 comments
Open

broken awk causes infinite agent loop #306

vdloo opened this issue Jan 25, 2018 · 0 comments

Comments

@vdloo
Copy link
Owner

vdloo commented Jan 25, 2018

[root@htpc1 ~]# awk
awk: error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory

[root@htpc1 raptiformica]# ps aux | grep 'bin/[r]aptiformica_agent.py' | grep -v screen -i | grep python3 | grep -v 'sh -c' | awk '{print $2}' | xargs --no-run-if-empty -I {} sh -c "grep -q docker /proc/{}/cgroup 2> /dev/null && ! grep -q name=systemd:/docker /proc/1/cgroup || echo {}" | wc -l | { read li; test $li -gt 1; }
awk: error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory

# awk is fixed with pacman -Syyu

In this scenario the agent thinks it is OK to start itself even though another instance may be already running. This check happens here. Perhaps the commandline tool should be pre-checked first (run --help, check for a zero exitcode) before adding a new machine to the network is allowed.

edit: alternatively the agent should check if another one is running in the loop and then terminate if so. in that case there could be a race condition where both (or more) running agents terminate and none are left running. that is not a problem because the consul watcher will re-start it when a cluster change occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant