Skip to content

broken awk causes infinite agent loop #306

@vdloo

Description

@vdloo
[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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions