[BUG] Many healthcheck processes remain when agent hangs
Agent Environment
reproduced at least on 7.34.0 and 7.43.1
Describe what happened:
When datadog agent process hangs for some reason, many healthcheck processes (/bin/sh /probe.sh, /opt/datadog-agent/bin/agent/agent health) hang and consume memory.
Healthcheck process is spawned by docker according to
https://github.com/DataDog/datadog-agent/blob/8f26aeee4fcf195a5375b41f75f039d7040f220e/Dockerfiles/agent/Dockerfile#L197-L198
As docker and docker-compose don't have feature to stop or restart unhealthy container, health check will be triggered infinitely.
Describe what you expected:
/opt/datadog-agent/bin/agent/agent health timeouts and return error when the agent is not responding.
Steps to reproduce the issue:
- Start datadog agent, for example by docker-compose
version: "2" services: datadog-agent: image: datadog/agent:latest environment: DD_API_KEY: "${DD_API_KEY}" DD_LOGS_ENABLED: "true" volumes: - /etc/machine-id:/etc/machine-id:ro - /var/run/docker.sock:/var/run/docker.sock:ro - Find agent PID and pause agent process by
# kill -SIGSTOP ${agent_pid} - Wait for some time
- Check processes
$ docker top ${agent_container_name} UID PID PPID C STIME TTY TIME CMD root 464 32109 0 10:36 ? 00:00:00 /bin/sh /probe.sh root 469 464 0 10:36 ? 00:00:00 /opt/datadog-agent/bin/agent/agent health root 620 32109 0 10:36 ? 00:00:00 /bin/sh /probe.sh root 625 620 0 10:36 ? 00:00:00 /opt/datadog-agent/bin/agent/agent health root 704 32109 0 10:37 ? 00:00:00 /bin/sh /probe.sh root 709 704 0 10:37 ? 00:00:00 /opt/datadog-agent/bin/agent/agent health root 780 32109 0 10:38 ? 00:00:00 /bin/sh /probe.sh root 787 780 0 10:38 ? 00:00:00 /opt/datadog-agent/bin/agent/agent health ...
Additional environment details (Operating System, Cloud provider, etc):
Note This happened on our IoT system and caused OOM. We've added a healthcheck result handling (restart agent container) after finding this, however it would be nice to be avoided by default.
We see this on v7.23.1 as well.
@at-wat Thank you for your report! We're now tracking this internally and will update this issue as we work on it. 🙇
Hi @at-wat,
This bug should be fixed now and will be available in version 7.46.0 of the Agent once it's released.