fix: replace qdrant healthcheck with perl io::socket instead of bash /dev/tcp#704
fix: replace qdrant healthcheck with perl io::socket instead of bash /dev/tcp#704yasinBursali wants to merge 1 commit intoLight-Heart-Labs:mainfrom
Conversation
Lightheartdevs
left a comment
There was a problem hiding this comment.
Audit Review
The intent is right — bash /dev/tcp is fragile and a bashism. But the replacement has issues.
Problem 1: Perl may not be available in the qdrant image
qdrant/qdrant:v1.16.3 is a minimal Rust binary image. There is zero precedent for perl healthchecks in the codebase (0 uses across 65+ compose files). The established patterns are:
curl -sf(14+ services)wget --spider(fallback)python3 urllib(Python-based images)
Problem 2: Wrong health endpoint
Both the old and new healthcheck probe /healthz, but:
- The manifest declares
health: / - The health check phase (
12-health.sh) probes/ - The qdrant README documents
GET /as the health endpoint
Suggested fix
Verify what tools are available in the qdrant image (curl, wget, or perl), then use the correct endpoint:
# If curl is available:
test: ["CMD", "curl", "-sf", "http://127.0.0.1:6333/"]
# If only wget:
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:6333/"]The 127.0.0.1 change (replacing localhost) is good regardless — keeps that part.
…mage) The qdrant/qdrant:v1.16.3 image ships with perl but no bash, curl, or wget. The previous healthcheck used bash /dev/tcp which fails silently. Also corrects the endpoint from /healthz to / (the documented qdrant health endpoint) and uses 127.0.0.1 instead of localhost to avoid IPv6 resolution issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f96c72a to
ae5eed0
Compare
|
Thanks for the review! I've addressed both concerns: 1. Tool availability — perl is the only option I tested the actual production image:
2. Endpoint fixed: Changed to match all three authoritative sources:
3. IPv4 preserved — Verified:
|
Problem
The Qdrant healthcheck used bash
/dev/tcp, which is fragile and hangs on some systems. The fix uses PerlIO::Socket::INETwith proper timeouts and IPv4 (127.0.0.1 instead of localhost).Solution
Replaced the bash healthcheck command with a Perl script that connects to port 6333, sends an HTTP GET request, and checks for status 200. Added
127.0.0.1(IPv4-safe) and removed the shell layer (CMD instead of CMD-SHELL).Testing
Verified Perl is available on
qdrant/qdrant:v1.16.3and tested against a live container. Manual test:docker compose upwith qdrant and verify healthcheck transitions fromstartingtohealthy.