dosubot[bot] commented on issue #3043: URL: https://github.com/apache/hugegraph/issues/3043#issuecomment-4582912522
<!-- Answer --> This is a confirmed architectural issue in HugeGraph's Docker setup. The root cause is clear from the entrypoint scripts: **All three components (Server, Store, PD) use `tail -f /dev/null` as the final command in their entrypoint scripts**, keeping the container's PID 1 alive indefinitely even after Java crashes [[1]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh#L87-L92) [[2]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh#L80-L81) [[3]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh#L85-L86). The startup scripts (`start-hugegraph-store.sh`, `start-hugegraph-pd.sh`) background the Java process with `&` [[4]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh#L224-L230) [[5]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh#L171-L177), so even though `exec` is used, the shell continues running since `&` prevents the process replacement. Docker sees PID 1 (`tail -f /dev/null`) as alive → container stays "Up" → restart policies never trigger. **Workaround** until this is fixed upstream: Add a `healthcheck` to your `docker-compose.yml` and combine it with `restart: unless-stopped`: ```yaml services: hugegraph-server: healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/versions"] interval: 15s timeout: 5s retries: 3 start_period: 30s restart: unless-stopped ``` Note: Docker's restart policy alone won't help here since the container never exits. The healthcheck will mark it unhealthy, but you'd need an external tool (like `autoheal`) to actually restart unhealthy containers, or use Docker Swarm/Kubernetes which natively restart unhealthy containers. **Proper fix** would involve modifying the entrypoint scripts to: 1. Remove `tail -f /dev/null` 2. Run Java as PID 1 (foreground, no `&`) so the container exits when Java dies 3. Use `dumb-init` (already installed in Store/PD images) for signal handling There's also an unused [cron-based monitor](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-monitor.sh#L38-L40) in the Server component (enabled via `-m` flag in `start-hugegraph.sh`), but it's not activated in the Docker entrypoint and only covers Server — not Store or PD. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fhugegraph).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fhugegraph). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fhugegraph&message_id=9b412c3a-407d-4008-a313-9186598d244c) [](https://github.dosu.com/apache/hugegraph?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fhugegraph) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fhugegraph) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
