Skip to content

DragonflyDB's health check script using nc has created zombie processes. #5844

@shaolila-dotcom

Description

@shaolila-dotcom

Describe the bug

To Reproduce
Steps to reproduce the behavior:
livenessProbe:
exec:
command:
- /bin/sh
- /usr/local/bin/healthcheck.sh
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
name: dragonfly
ports:
- containerPort: 6379
name: redis
protocol: TCP
- containerPort: 9999
name: admin
protocol: TCP
readinessProbe:
exec:
command:
- /bin/sh
- /usr/local/bin/healthcheck.sh
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5

and
cat /usr/local/bin/healthcheck.sh
#!/bin/sh

HOST="localhost"
PORT=$HEALTHCHECK_PORT

if [ -z "$HEALTHCHECK_PORT" ]; then
DF_NET=$(netstat -tlnp | grep "1/dragonfly")
if [ -z "$DF_NET" ]; then
# if we failed, then lets try the priveleged version. is triggerred by the regular command:
# docker run docker.dragonflydb.io/dragonflydb/dragonfly
DF_NET=$(su dfly -c "netstat -tlnp" | grep "1/dragonfly")

fi

PORT=$(echo $DF_NET | grep -oE ':[0-9]+' | cut -c2- | tail -n 1)
fi

_healthcheck="nc -q1 $HOST $PORT"

echo PING | ${_healthcheck}

exit $?

Image Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions