Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-07 Thread via GitHub


imbajin merged PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187


-- 
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]



Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-06 Thread via GitHub


bitflicker64 commented on PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#issuecomment-5565660979

   Fixed in `f24eaaf59`, taking all four points.
   
   Section 7 is gone. One environment variable did not need a top-level 
section, so it is now two sentences at the end of section 6, beside the health 
check it interacts with. The budget arithmetic and the `docker run` example 
moved into a `` block, and `docker/README.md` got the same treatment. 
Added prose now runs long instead of wrapping at about 70, which also matches 
the rest of that file. Net 26 lines lighter.
   
   Two things that would have broken with the section: `docker/README.md` 
linked to `#7-server-startup-timeout`, now 
`#6-process-supervision--health-checks`, and `test-compose.sh:323` cited 
"README section 7".
   


-- 
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]



Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-06 Thread via GitHub


bitflicker64 commented on PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#issuecomment-5560515947

   @imbajin Ready for a review pass when you have time. Pushed `585b099` and 
`7e2818c`, both docs and test-harness only.
   
   **Why those two commits.** The `### Server startup timeout` section in 
`docker/README.md` demonstrated `HG_SERVER_STARTUP_TIMEOUT_S=450 docker compose 
up -d`, and 450 is past the budget that command actually has to clear. The 
server health check in `docker/docker-compose.yml` and 
`docker-compose-hstore.yml` is `start_period: 60s` plus `retries: 30` at 
`interval: 10s`, roughly 360 seconds, and hubble carries `depends_on: server: 
condition: service_healthy` in both files. `docker compose up -d` honors 
`service_healthy` without `--wait`, so on the slow host that example is written 
for, the pasted command exits non-zero with hubble unstarted. The caveat two 
sentences below named only `up -d --wait`, which reads as safe to anyone not 
passing that flag.
   
   `585b099` lowers the example to 300 and reworks the caveat to name the 
`depends_on: service_healthy` path as well, so a reader who genuinely needs 
more than 360 seconds is still told what to change. It also gives 
`compose_active` in `docker/test-compose.sh` the same `env -u 
HG_SERVER_STARTUP_TIMEOUT_S` that `compose_auth` already had, so a developer 
with the variable exported empty does not get server containers exiting on the 
new guard during `test-compose.sh smoke` with the crash looking unrelated to 
their shell. CI was unaffected either way, since the variable is unset there.
   
   `7e2818c` is one token. `hugegraph-server/hugegraph-dist/docker/README.md` 
showed the same Compose command at 450, so the two READMEs contradicted each 
other; it is now 300 in both. The `docker run` example in that file stays at 
450 deliberately: `docker run` does not block on health, the image defaults are 
`--interval=15s --start-period=90s --retries=3`, and the section already tells 
the reader the container reports unhealthy around 135 seconds and to raise 
`--health-start-period`.
   
   **What I checked on the branch.** The validation matrix against the real 
entrypoint: unset, empty, `" 300 "` with spaces, `+300`, `0300`, `300s`, `1e3`, 
`-1`, `0`, `86401`, the 64-bit max, and a trailing newline. Each behaves as 
documented and the entrypoint refuses loudly rather than proceeding on a 
garbage value. A trailing newline is rejected because bash ERE `$` is end of 
string, not end of line.
   
   `(( ))` evaluates variable contents recursively, so I went looking for an 
expression that could reach it. The guard is `[[ ! ... =~ ^[1-9][0-9]{0,4}$ ]] 
|| (( ... ))`, which short-circuits, so the arithmetic only ever runs on an 
already-matched plain integer. On the Compose side the unset-only `-` default 
means an explicitly empty value still reaches the container and is refused 
there instead of being dropped as a YAML null, and nothing lets the value 
inject into the rendered config.
   
   Ordering holds: the guard is at `docker-entrypoint.sh:114-122`, the first 
`set_prop` at 149, `init-store.sh` at 219, so a bad value mutates nothing. A 
typo produces a clear refusal on every restart rather than a quiet one, and 
that is still better than the old behaviour, where a slow host let the server 
die and loop at 120s with nothing explaining why. `docker-entrypoint-test.sh` 
fails with `expected start-hugegraph.sh -t 450, got -t 120` when the entrypoint 
is reverted to the merge base, so it catches the regression it exists for.
   
   **One nit I left alone.** The regex admits up to 9 and a second check 
refuses anything over 86400, so the bounds live in two places. The error 
message is correct either way and collapsing them would churn the tests, so it 
did not seem worth it. Happy to do it if you would rather have one check.
   


-- 
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]



Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-06 Thread via GitHub


bitflicker64 commented on code in PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#discussion_r3943255563


##
docker/test-compose.sh:
##
@@ -263,6 +291,23 @@ run_render() {
 assert_ha "${RENDER_DIR}/ha.json"
 assert_dev_override "${RENDER_DIR}/dev.json" \
 "${RENDER_DIR}/override.json"
+
+# An absent host value renders the entrypoint default in every topology,
+# and a host value overrides it, so the container budget can be aligned
+# with the healthcheck start period without editing the Compose files.
+assert_startup_timeout "${RENDER_DIR}/standalone.json" 120 server
+assert_startup_timeout "${RENDER_DIR}/hstore.json" 120 server
+assert_startup_timeout "${RENDER_DIR}/ha.json" 120 server0 server1 server2
+render_with_timeout "${RENDER_DIR}/standalone-timeout.json" 450 \
+-f "${DOCKER_DIR}/docker-compose.yml"
+render_with_timeout "${RENDER_DIR}/hstore-timeout.json" 450 \
+-f "${DOCKER_DIR}/docker-compose-hstore.yml"
+render_with_timeout "${RENDER_DIR}/ha-timeout.json" 450 \
+-f 
"${DOCKER_DIR}/docker-compose-3pd-3store-3server.yml"
+assert_startup_timeout "${RENDER_DIR}/standalone-timeout.json" 450 server
+assert_startup_timeout "${RENDER_DIR}/hstore-timeout.json" 450 server
+assert_startup_timeout "${RENDER_DIR}/ha-timeout.json" 450 \
+   server0 server1 server2

Review Comment:
   Fixed in f2c6a1ff4, taking the suggestion. Confirmed the blind spot first: 
rewriting all three Compose files to `${HG_SERVER_STARTUP_TIMEOUT_S:-120}` left 
the whole suite green, and an empty host value rendered `"120"` there against 
`""` here.
   
   All three topologies are now rendered with an empty value and asserted to 
carry one. Verified the assertion fails the `:-` rewrite with exactly `expected 
server HG_SERVER_STARTUP_TIMEOUT_S= in .../standalone-empty.json`.



##
docker/docker-compose.yml:
##
@@ -34,6 +34,10 @@ services:
   PASSWORD: ${HUGEGRAPH_ADMIN_PASSWORD:-}
   HG_SERVER_AUTH_TOKEN_SECRET: ${HUGEGRAPH_AUTH_TOKEN_SECRET:-}
   HG_SERVER_MIN_FREE_MEMORY: "0"
+  # Unset-only default: a host value overrides it, an absent one
+  # renders the entrypoint default. ":-" would turn an empty host
+  # value into 120 silently, which the entrypoint rejects on purpose.
+  HG_SERVER_STARTUP_TIMEOUT_S: ${HG_SERVER_STARTUP_TIMEOUT_S-120}

Review Comment:
   Fixed in f2c6a1ff4. The comment now says the knob aligns the two budgets 
downward only: lowering the container budget to meet the health budget needs no 
file edit, raising it past that budget does, because the health values are 
literals giving every Server about 360 seconds and the documented `up -d 
--wait` gives up there.
   
   Checked the rendered values rather than the source lines: `interval: 10s`, 
`retries: 30`, `start_period: 60s` on the Server of all three topologies. 
Section 7 keeps the reader-facing version, and `docker/README.md` now carries 
it too. Agreed that interpolating the health budget belongs in a follow-up 
issue rather than here.



##
docker/test-compose.sh:
##
@@ -43,6 +44,33 @@ render() {
 compose_auth "$@" config --format json > "${output}"
 }
 
+# Same render with an explicit host value, to prove the variable reaches the
+# Server environment rather than only defaulting there.
+render_with_timeout() {
+local output="$1" timeout="$2"
+shift 2
+env HG_SERVER_STARTUP_TIMEOUT_S="${timeout}" \

Review Comment:
   Fixed in f2c6a1ff4, taking the suggestion. `STARTUP_TIMEOUT_ENV` is the only 
thing the two renders differ by, and `render_with_timeout` rebinds it in a 
subshell.
   
   Verified the drift it prevents: adding a variable to `compose_auth` alone 
and asserting on the rendered Server environment now reports `true` for the 
baseline, the override and the empty render alike. Under the duplicated version 
the latter two would have missed it, which is the #3189 case you describe.



##
docker/docker-compose-hstore.yml:
##
@@ -92,6 +92,7 @@ services:
   HG_SERVER_REST_URL: http://server:8080
   HG_SERVER_MIN_FREE_MEMORY: "0"
   HG_SERVER_INIT_STORE_ENABLED: "false"
+  HG_SERVER_STARTUP_TIMEOUT_S: ${HG_SERVER_STARTUP_TIMEOUT_S-120}

Review Comment:
   Fixed in f2c6a1ff4. Both files now carry the same two-line note as the 
standalone file, at their own indent, so the missing colon does not read as a 
typo beside `HG_SERVER_AUTH_TOKEN_SECRET: ${HUGEGRAPH_AUTH_TOKEN_SECRET:-}`.



##
hugegraph-server/hugegraph-dist/docker/README.md:
##
@@ -144,3 +144,35 @@ native `HEALTHCHECK` instructions. `docker ps` shows real 
health status:
 | `hugegraph/hugegraph-store` | `GET /v1/health` on port 8520 |
 
 The entrypoints supervise the Java process directly — when Java exits, the 
container exits. If started with a restart policy 

Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-05 Thread via GitHub


bitflicker64 commented on code in PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#discussion_r3941731880


##
docker/test-compose.sh:
##
@@ -263,6 +291,23 @@ run_render() {
 assert_ha "${RENDER_DIR}/ha.json"
 assert_dev_override "${RENDER_DIR}/dev.json" \
 "${RENDER_DIR}/override.json"
+
+# An absent host value renders the entrypoint default in every topology,
+# and a host value overrides it, so the container budget can be aligned
+# with the healthcheck start period without editing the Compose files.
+assert_startup_timeout "${RENDER_DIR}/standalone.json" 120 server
+assert_startup_timeout "${RENDER_DIR}/hstore.json" 120 server
+assert_startup_timeout "${RENDER_DIR}/ha.json" 120 server0 server1 server2
+render_with_timeout "${RENDER_DIR}/standalone-timeout.json" 450 \
+-f "${DOCKER_DIR}/docker-compose.yml"
+render_with_timeout "${RENDER_DIR}/hstore-timeout.json" 450 \
+-f "${DOCKER_DIR}/docker-compose-hstore.yml"
+render_with_timeout "${RENDER_DIR}/ha-timeout.json" 450 \
+-f 
"${DOCKER_DIR}/docker-compose-3pd-3store-3server.yml"
+assert_startup_timeout "${RENDER_DIR}/standalone-timeout.json" 450 server
+assert_startup_timeout "${RENDER_DIR}/hstore-timeout.json" 450 server
+assert_startup_timeout "${RENDER_DIR}/ha-timeout.json" 450 \
+   server0 server1 server2

Review Comment:
   ⚠️ These assertions cannot see the `-` vs `:-` choice the rest of the change 
rests on.
   
   Both cases they cover are satisfied by either spelling: unset renders `120` 
and `450` renders `450` under `${VAR-120}` and `${VAR:-120}` alike. The 
difference only shows for an explicitly empty host value, the case 
`docker-entrypoint.sh` was changed to reject and that 
`docker-compose.yml:37-39` and README section 7 ("an empty value included, 
stops the container at startup") promise reaches the container.
   
   Verified on this head: rewriting all three Compose files to 
`${HG_SERVER_STARTUP_TIMEOUT_S:-120}` still gives `Compose render contracts 
passed`, while the empty host value silently renders `"120"` instead of `""`. 
With the block below the suite passes as it stands and fails that variant with 
`expected server HG_SERVER_STARTUP_TIMEOUT_S= in .../standalone-empty.json`.
   
   ```suggestion
   assert_startup_timeout "${RENDER_DIR}/ha-timeout.json" 450 \
  server0 server1 server2
   render_with_timeout "${RENDER_DIR}/standalone-empty.json" "" \
   -f "${DOCKER_DIR}/docker-compose.yml"
   render_with_timeout "${RENDER_DIR}/hstore-empty.json" "" \
   -f "${DOCKER_DIR}/docker-compose-hstore.yml"
   render_with_timeout "${RENDER_DIR}/ha-empty.json" "" \
   -f 
"${DOCKER_DIR}/docker-compose-3pd-3store-3server.yml"
   assert_startup_timeout "${RENDER_DIR}/standalone-empty.json" "" server
   assert_startup_timeout "${RENDER_DIR}/hstore-empty.json" "" server
   assert_startup_timeout "${RENDER_DIR}/ha-empty.json" "" \
  server0 server1 server2
   ```



##
docker/docker-compose-hstore.yml:
##
@@ -92,6 +92,7 @@ services:
   HG_SERVER_REST_URL: http://server:8080
   HG_SERVER_MIN_FREE_MEMORY: "0"
   HG_SERVER_INIT_STORE_ENABLED: "false"
+  HG_SERVER_STARTUP_TIMEOUT_S: ${HG_SERVER_STARTUP_TIMEOUT_S-120}

Review Comment:
   🧹 The reason for the missing colon lives in only one of the three files.
   
   `docker-compose.yml:37-39` explains it. Here, and at 
`docker-compose-3pd-3store-3server.yml:71`, a bare 
`${HG_SERVER_STARTUP_TIMEOUT_S-120}` sits directly above 
`HG_SERVER_AUTH_TOKEN_SECRET: ${HUGEGRAPH_AUTH_TOKEN_SECRET:-}`, so to a later 
editor it reads as a dropped colon next to a neighbour that has one. Since the 
render suite cannot currently catch that edit, the comment is the cheap half of 
the guard.
   
   ```suggestion
 # Unset-only default: ":-" would turn an empty host value into 120
 # silently, which the entrypoint rejects on purpose.
 HG_SERVER_STARTUP_TIMEOUT_S: ${HG_SERVER_STARTUP_TIMEOUT_S-120}
   ```
   
   The HA anchor at line 71 wants the same two lines at its two-space indent.



##
docker/test-compose.sh:
##
@@ -43,6 +44,33 @@ render() {
 compose_auth "$@" config --format json > "${output}"
 }
 
+# Same render with an explicit host value, to prove the variable reaches the
+# Server environment rather than only defaulting there.
+render_with_timeout() {
+local output="$1" timeout="$2"
+shift 2
+env HG_SERVER_STARTUP_TIMEOUT_S="${timeout}" \

Review Comment:
   🧹 `render_with_timeout` re-lists `compose_auth`'s four environment variables 
instead of reusing it, so the two drift apart on the next variable added.
   
   Lines 52-56 are a verbatim copy of lines 33-37 with 

Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-05 Thread via GitHub


bitflicker64 commented on PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#issuecomment-5550447211

   Tested on Kubernetes on 2026-09-05, with this branch merged into the 
hugegraph/hugegraph testing tree.
   
   **Build under test.** Tag 
[`helm-dev-20260905`](https://github.com/hugegraph/hugegraph/releases/tag/helm-dev-20260905),
 commit `6ec19838`: apache master `36811483` plus this PR at `0ba30a1e`, #3185 
and #3189. The Server image was built from that tree with `docker buildx bake 
-f docker/bake.hcl server-hstore` (linux/amd64) and carries 
`org.opencontainers.image.revision=6ec1983889f58a52995b27a4e1ea89bd00932396`, 
read back from the running pods. The #3132 chart set 
`HG_SERVER_STARTUP_TIMEOUT_S=450` through `server.extraEnv`, matching its 450 s 
startup probe.
   
   - Invalid value: a one-off Pod from the same image with 
`HG_SERVER_STARTUP_TIMEOUT_S=abc` exited 1 with `ERROR: 
HG_SERVER_STARTUP_TIMEOUT_S must be a whole number of seconds from 1 to 86400, 
got 'abc'`, before init-store ran.
   - Valid value: after deleting a Server Pod, `ps` in the replacement 2 s into 
its start showed `./bin/start-hugegraph.sh -j ... -t 450`, and 
`/proc/1/environ` carried `HG_SERVER_STARTUP_TIMEOUT_S=450`. Three Servers, two 
Server rollouts and one image roll all started clean.
   - Not observed: a start slower than 120 s, so the last link, the start 
script honouring `-t`, rests on this PR's own tests rather than on this run. 
The old self-termination did not appear anywhere.
   
   One note for whoever merges second: #3189 makes the Compose files require 
`HG_PD_AUTH_SECRET_KEY`, so `render_with_timeout` in `docker/test-compose.sh` 
needs `HG_PD_AUTH_SECRET_KEY="${PD_SECRET}"` in its `env` list, or 
`test-compose.sh render` fails on the two HStore topologies. That is how the 
tag resolves it.
   


-- 
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]



Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-04 Thread via GitHub


bitflicker64 commented on PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#issuecomment-5549881527

   The `hstore` failure on attempt 1 looks like a timing flake rather than 
anything in this PR, noting it here so it does not need diagnosing twice.
   
   One failure out of 814 tests: 
`VertexCoreTest.testAddVertexWithTtlAndTtlStartTime`, at 
[`VertexCoreTest.java:1300`](https://github.com/apache/hugegraph/blob/36811483a2040f70ca6923a288a8c28cad0086c0/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java#L1300).
 The assertion there is `Assert.assertTrue(vertices.hasNext())` immediately 
after `Thread.sleep(1100L)`, checking a TTL vertex is still alive, so it 
depends on the sleep landing inside the remaining TTL window on a loaded runner.
   
   Attribution, for what it is worth: this branch changes three Compose files, 
`test-compose.sh`, the Docker entrypoint, its test and the docker README, and 
no Java. The master commit merged in here, 3681148 (#3182), added only 
`testQueryByPrimaryValuesAndPropsWithCachedVertex` to that file and left the 
TTL method alone. The same job flaked once on the previous head and passed on 
the retry.
   
   Attempt 2 is running now. Happy to open a separate issue for the TTL timing 
if it is worth tracking.
   


-- 
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]



Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-04 Thread via GitHub


bitflicker64 commented on code in PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#discussion_r3939609317


##
hugegraph-server/hugegraph-dist/docker/README.md:
##
@@ -144,3 +144,30 @@ native `HEALTHCHECK` instructions. `docker ps` shows real 
health status:
 | `hugegraph/hugegraph-store` | `GET /v1/health` on port 8520 |
 
 The entrypoints supervise the Java process directly — when Java exits, the 
container exits. If started with a restart policy (the provided compose files 
use `restart: unless-stopped`), Docker will bring it back automatically. The 
old cron-based monitor (`-m true`) is for VM/bare-metal deployments only and is 
not used in Docker images.
+
+## 7. Server Startup Timeout
+
+The entrypoint gives the Server a fixed budget to answer on its REST port and
+ends the container when the budget runs out. It is 120 seconds by default. Set
+`HG_SERVER_STARTUP_TIMEOUT_S` to a whole number of seconds between 1 and 86400

Review Comment:
   Fixed in 0ba30a1e7. Confirmed the reproduction first: `docker compose -f 
docker/docker-compose.yml config` emitted no such key.
   
   All three topologies now carry `HG_SERVER_STARTUP_TIMEOUT_S: 
${HG_SERVER_STARTUP_TIMEOUT_S-120}`, unset-only as you asked, so an absent host 
value renders 120 while an explicitly empty one reaches the entrypoint and is 
rejected there instead of silently becoming the default. The HA file gets it 
through the `x-server-environment` anchor, so all three Servers share it.
   
   `test-compose.sh render` now asserts the default and a 450 override on every 
Server service, and `compose_auth` strips the variable so the baseline render 
cannot be coloured by the developer's environment. Verified the assertion fails 
when the key is removed from a Compose file.



##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##
@@ -232,4 +233,60 @@ rm -f "${TEST_HOME}/docker/init_complete"
 )
 grep -Fqx -- '-n' "${TEST_HOME}/docker/init-store-password"
 
+last_start_args() { tail -n 1 "${TEST_HOME}/docker/start-hugegraph-args"; }
+
+[[ "$(last_start_args)" == *"-t 120"* ]]
+
+(
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=450 bash ./docker-entrypoint.sh
+)
+[[ "$(last_start_args)" == *"-t 450"* ]]

Review Comment:
   Fixed in 0ba30a1e7. The positive cases now use an `assert_start_timeout` 
helper that exits explicitly and prints the value it saw, so bash 3.2 no longer 
reaches PASS through a failing `[[ ]]`.
   
   Verified on 3.2.57: changing the entrypoint default to 999 now reports 
`expected start-hugegraph.sh -t 120, got -t 999` instead of passing. The suite 
passes on both 3.2.57 and 5.3.15.



##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##
@@ -232,4 +233,60 @@ rm -f "${TEST_HOME}/docker/init_complete"
 )
 grep -Fqx -- '-n' "${TEST_HOME}/docker/init-store-password"
 
+last_start_args() { tail -n 1 "${TEST_HOME}/docker/start-hugegraph-args"; }
+
+[[ "$(last_start_args)" == *"-t 120"* ]]

Review Comment:
   Fixed in 0ba30a1e7. The stub now writes `printf '%s\n' "$@" > 
./docker/start-hugegraph-argv`, one argument per line, and `last_start_timeout` 
walks that vector to return the exact argument following `-t`. Assertions 
compare it with `!=` rather than a substring.
   
   Verified with your case: making the entrypoint pass `-t 1200` now reports 
`expected start-hugegraph.sh -t 120, got -t 1200`, where the old substring 
check passed. Call counting moved to a separate `start-hugegraph-calls` log so 
the argv file can be overwritten per call.



##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##
@@ -232,4 +233,60 @@ rm -f "${TEST_HOME}/docker/init_complete"
 )
 grep -Fqx -- '-n' "${TEST_HOME}/docker/init-store-password"
 
+last_start_args() { tail -n 1 "${TEST_HOME}/docker/start-hugegraph-args"; }
+
+[[ "$(last_start_args)" == *"-t 120"* ]]
+
+(
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=450 bash ./docker-entrypoint.sh
+)
+[[ "$(last_start_args)" == *"-t 450"* ]]
+
+(
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=86400 bash ./docker-entrypoint.sh
+)
+[[ "$(last_start_args)" == *"-t 86400"* ]]
+
+# An empty value is a set value, not an absent one: Compose writes it whenever
+# an interpolated host variable is missing. 2m is the shape of a typo, and the
+# two large values bracket the point where the deadline arithmetic in
+# wait_for_startup would wrap negative and end the wait before its first probe.
+for invalid_timeout in "" " " 0 +5 2m 86401 9223372036854775807; do
+start_calls_before_invalid=$(wc -l < 
"${TEST_HOME}/docker/start-hugegraph-args")
+init_calls_before_invalid=$(wc -l < "${TEST_HOME}/docker/init-store-calls")
+if (
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S="${invalid_timeout}" \
+bash ./docker-entrypoint.sh
+); then
+echo "startup timeout '${invalid_timeout}' unexpectedly succeeded" >&2
+

Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-04 Thread via GitHub


imbajin commented on code in PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#discussion_r3933756783


##
hugegraph-server/hugegraph-dist/docker/README.md:
##
@@ -144,3 +144,30 @@ native `HEALTHCHECK` instructions. `docker ps` shows real 
health status:
 | `hugegraph/hugegraph-store` | `GET /v1/health` on port 8520 |
 
 The entrypoints supervise the Java process directly — when Java exits, the 
container exits. If started with a restart policy (the provided compose files 
use `restart: unless-stopped`), Docker will bring it back automatically. The 
old cron-based monitor (`-m true`) is for VM/bare-metal deployments only and is 
not used in Docker images.
+
+## 7. Server Startup Timeout
+
+The entrypoint gives the Server a fixed budget to answer on its REST port and
+ends the container when the budget runs out. It is 120 seconds by default. Set
+`HG_SERVER_STARTUP_TIMEOUT_S` to a whole number of seconds between 1 and 86400

Review Comment:
   ⚠️ The new variable is not propagated by any provided Compose topology. 
`docker/docker-compose.yml`, `docker/docker-compose-hstore.yml`, and 
`docker/docker-compose-3pd-3store-3server.yml` do not declare 
`HG_SERVER_STARTUP_TIMEOUT_S` in the Server environment. Reproduction on this 
head: `HG_SERVER_STARTUP_TIMEOUT_S=450 docker compose -f 
docker/docker-compose.yml config --format json` emits no such key, so the 
container still uses the entrypoint default `120` and the healthcheck budget 
cannot be aligned. Please add the variable to each Server environment/anchor 
with unset-only default semantics and cover it in the Compose render test.



##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##
@@ -232,4 +233,60 @@ rm -f "${TEST_HOME}/docker/init_complete"
 )
 grep -Fqx -- '-n' "${TEST_HOME}/docker/init-store-password"
 
+last_start_args() { tail -n 1 "${TEST_HOME}/docker/start-hugegraph-args"; }
+
+[[ "$(last_start_args)" == *"-t 120"* ]]
+
+(
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=450 bash ./docker-entrypoint.sh
+)
+[[ "$(last_start_args)" == *"-t 450"* ]]
+
+(
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=86400 bash ./docker-entrypoint.sh
+)
+[[ "$(last_start_args)" == *"-t 86400"* ]]
+
+# An empty value is a set value, not an absent one: Compose writes it whenever
+# an interpolated host variable is missing. 2m is the shape of a typo, and the
+# two large values bracket the point where the deadline arithmetic in
+# wait_for_startup would wrap negative and end the wait before its first probe.
+for invalid_timeout in "" " " 0 +5 2m 86401 9223372036854775807; do
+start_calls_before_invalid=$(wc -l < 
"${TEST_HOME}/docker/start-hugegraph-args")
+init_calls_before_invalid=$(wc -l < "${TEST_HOME}/docker/init-store-calls")
+if (
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S="${invalid_timeout}" \
+bash ./docker-entrypoint.sh
+); then
+echo "startup timeout '${invalid_timeout}' unexpectedly succeeded" >&2
+exit 1
+fi
+# The server must not have started, and the guard must have run ahead of
+# init-store, as the comment above it in the entrypoint claims. Spelled
+# with an explicit exit rather than a bare [[ ]]: bash 3.2, still the
+# /bin/bash of macOS, does not apply set -e to a failing [[ ]], so a bare
+# assertion passes silently there while CI catches the regression.
+[[ "$(wc -l < "${TEST_HOME}/docker/start-hugegraph-args")" -eq \
+   "${start_calls_before_invalid}" ]] || {
+echo "startup timeout '${invalid_timeout}' started the server" >&2
+exit 1
+}
+[[ "$(wc -l < "${TEST_HOME}/docker/init-store-calls")" -eq \
+   "${init_calls_before_invalid}" ]] || {
+echo "startup timeout '${invalid_timeout}' was rejected only after" \
+ "init-store ran" >&2
+exit 1
+}
+done
+
+# An unset variable still keeps the historical default.
+(
+cd "${TEST_HOME}"
+bash ./docker-entrypoint.sh

Review Comment:
   ⚠️ This block claims to exercise an unset variable but only starts a child 
shell; it does not unset an inherited `HG_SERVER_STARTUP_TIMEOUT_S`. Running 
the test with `export HG_SERVER_STARTUP_TIMEOUT_S=450` makes this call exercise 
`450` instead of the default `120`, and the bare assertion can still report 
success on Bash 3.2. Please invoke it with `env -u HG_SERVER_STARTUP_TIMEOUT_S` 
or unset the variable inside the subshell, while keeping an explicit failing 
assertion.



##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##
@@ -232,4 +233,60 @@ rm -f "${TEST_HOME}/docker/init_complete"
 )
 grep -Fqx -- '-n' "${TEST_HOME}/docker/init-store-password"
 
+last_start_args() { tail -n 1 "${TEST_HOME}/docker/start-hugegraph-args"; }
+
+[[ "$(last_start_args)" == *"-t 120"* ]]

Review Comment:
   ⚠️ `last_start_args` records the whole `$*`, and `*"-t 120"*` / `*"-t 450"*` 
only checks a 

Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-03 Thread via GitHub


bitflicker64 commented on code in PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#discussion_r3924578435


##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##
@@ -98,6 +98,19 @@ if [[ -n "${HG_SERVER_AUTH_TOKEN_SECRET:-}" ]]; then
 fi
 fi
 
+# How long the entrypoint lets the server take to answer on its REST port
+# before it gives up and ends the container. An orchestrator that already
+# owns this budget through a startup probe needs to raise it, otherwise the
+# container terminates a JVM that is still starting and the probe never gets
+# to decide. Validated here so a typo fails before init-store runs, rather
+# than reaching the arithmetic in wait_for_startup.
+SERVER_STARTUP_TIMEOUT_S="${HG_SERVER_STARTUP_TIMEOUT_S:-120}"
+if [[ ! "${SERVER_STARTUP_TIMEOUT_S}" =~ ^[1-9][0-9]*$ ]]; then

Review Comment:
   Fixed in 6ca3df360. Reproduced first: with `now_s=1788438716`, `$((now_s + 
9223372036854775807))` gives `-9223372035066337093`, so `[ "$now_s" -lt 
"$stop_s" ]` is false and the loop never probes.
   
   The accepted range is now 1 to 86400 seconds. The pattern is bounded to five 
digits (`^[1-9][0-9]{0,4}$`) before the upper-bound comparison runs, so the 
comparison itself cannot overflow either; bash wraps a 20-digit literal 
silently rather than erroring, so the regex has to do that part. Boundary tests 
added for 86400 accepted, 86401 and 9223372036854775807 rejected.



##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##
@@ -98,6 +98,19 @@ if [[ -n "${HG_SERVER_AUTH_TOKEN_SECRET:-}" ]]; then
 fi
 fi
 
+# How long the entrypoint lets the server take to answer on its REST port
+# before it gives up and ends the container. An orchestrator that already
+# owns this budget through a startup probe needs to raise it, otherwise the
+# container terminates a JVM that is still starting and the probe never gets
+# to decide. Validated here so a typo fails before init-store runs, rather
+# than reaching the arithmetic in wait_for_startup.
+SERVER_STARTUP_TIMEOUT_S="${HG_SERVER_STARTUP_TIMEOUT_S:-120}"

Review Comment:
   Fixed in 6ca3df360, taking the suggestion. Confirmed the behaviour: 
`${v:-120}` on an empty value yields `120`, `${v-120}` yields empty and so 
fails the guard, and an unset variable still yields `120` either way. 
`docker/docker-compose.yml:34-35` uses the `${VAR:-}` style, so this was 
reachable.
   
   The README sentence now says an empty value is rejected too, rather than the 
reverse. Empty and whitespace-only are both in the rejected set in the test.



##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##
@@ -232,4 +233,25 @@ rm -f "${TEST_HOME}/docker/init_complete"
 )
 grep -Fqx -- '-n' "${TEST_HOME}/docker/init-store-password"
 
+last_start_args() { tail -n 1 "${TEST_HOME}/docker/start-hugegraph-args"; }
+
+[[ "$(last_start_args)" == *"-t 120"* ]]
+
+(
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=450 bash ./docker-entrypoint.sh
+)
+[[ "$(last_start_args)" == *"-t 450"* ]]
+
+start_calls_before_invalid_timeout=$(wc -l < 
"${TEST_HOME}/docker/start-hugegraph-args")
+if (
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=2m bash ./docker-entrypoint.sh
+); then
+echo "invalid startup timeout unexpectedly succeeded" >&2
+exit 1
+fi
+[[ "$(wc -l < "${TEST_HOME}/docker/start-hugegraph-args")" -eq \
+   "${start_calls_before_invalid_timeout}" ]]

Review Comment:
   Fixed in 6ca3df360. Your relocated-guard variant is now caught: I reproduced 
it by moving the block below all three `init-store.sh` call sites, and the 
suite fails with `startup timeout '' was rejected only after init-store ran`.
   
   One thing worth flagging from checking it. The bare `[[ ]]` assertion style 
does not fail on bash 3.2, still the `/bin/bash` of macOS: `set -e` there 
ignores a failing `[[ ]]`, so my first run of your variant passed locally and 
only failed under bash 5.3. The new assertions use an explicit `|| { echo ...; 
exit 1; }` so they fail on both. Verified under 3.2.57 and 5.3.15.



##
hugegraph-server/hugegraph-dist/docker/README.md:
##
@@ -144,3 +144,20 @@ native `HEALTHCHECK` instructions. `docker ps` shows real 
health status:
 | `hugegraph/hugegraph-store` | `GET /v1/health` on port 8520 |
 
 The entrypoints supervise the Java process directly — when Java exits, the 
container exits. If started with a restart policy (the provided compose files 
use `restart: unless-stopped`), Docker will bring it back automatically. The 
old cron-based monitor (`-m true`) is for VM/bare-metal deployments only and is 
not used in Docker images.
+
+## 7. Server Startup Timeout
+
+The entrypoint gives the Server a fixed budget to answer on its REST port and
+ends the container when the budget runs out. It is 120 seconds by default. Set
+`HG_SERVER_STARTUP_TIMEOUT_S` to a positive whole number of seconds to change
+it:
+
+```bash
+docker run -itd 

Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-02 Thread via GitHub


bitflicker64 commented on code in PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#discussion_r3921393601


##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##
@@ -232,4 +233,25 @@ rm -f "${TEST_HOME}/docker/init_complete"
 )
 grep -Fqx -- '-n' "${TEST_HOME}/docker/init-store-password"
 
+last_start_args() { tail -n 1 "${TEST_HOME}/docker/start-hugegraph-args"; }
+
+[[ "$(last_start_args)" == *"-t 120"* ]]
+
+(
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=450 bash ./docker-entrypoint.sh
+)
+[[ "$(last_start_args)" == *"-t 450"* ]]
+
+start_calls_before_invalid_timeout=$(wc -l < 
"${TEST_HOME}/docker/start-hugegraph-args")
+if (
+cd "${TEST_HOME}"
+HG_SERVER_STARTUP_TIMEOUT_S=2m bash ./docker-entrypoint.sh
+); then
+echo "invalid startup timeout unexpectedly succeeded" >&2
+exit 1
+fi
+[[ "$(wc -l < "${TEST_HOME}/docker/start-hugegraph-args")" -eq \
+   "${start_calls_before_invalid_timeout}" ]]

Review Comment:
   🧹 This block pins down that the server was not started, but not the ordering 
stated in the comment above the guard (`Validated here so a typo fails before 
init-store runs`). I copied the entrypoint, moved the whole validation block 
from line 101 down to just above the `./bin/start-hugegraph.sh` call so it runs 
after all three `init-store.sh` call sites, and `docker-entrypoint-test.sh` 
still exited 0. The invalid run executes `init-store.sh` in that variant, and 
every `init-store-calls` assertion sits earlier in the file, so nothing 
observes it.
   
   Snapshotting the init-store count alongside the start count closes the gap. 
Verified under bash 5.3: exit 0 against this PR, exit 1 against the relocated 
guard.
   
   ```suggestion
   start_calls_before_invalid_timeout=$(wc -l < 
"${TEST_HOME}/docker/start-hugegraph-args")
   init_calls_before_invalid_timeout=$(wc -l < 
"${TEST_HOME}/docker/init-store-calls")
   if (
   cd "${TEST_HOME}"
   HG_SERVER_STARTUP_TIMEOUT_S=2m bash ./docker-entrypoint.sh
   ); then
   echo "invalid startup timeout unexpectedly succeeded" >&2
   exit 1
   fi
   [[ "$(wc -l < "${TEST_HOME}/docker/start-hugegraph-args")" -eq \
  "${start_calls_before_invalid_timeout}" ]]
   [[ "$(wc -l < "${TEST_HOME}/docker/init-store-calls")" -eq \
  "${init_calls_before_invalid_timeout}" ]]
   ```



##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##
@@ -98,6 +98,19 @@ if [[ -n "${HG_SERVER_AUTH_TOKEN_SECRET:-}" ]]; then
 fi
 fi
 
+# How long the entrypoint lets the server take to answer on its REST port
+# before it gives up and ends the container. An orchestrator that already
+# owns this budget through a startup probe needs to raise it, otherwise the
+# container terminates a JVM that is still starting and the probe never gets
+# to decide. Validated here so a typo fails before init-store runs, rather
+# than reaching the arithmetic in wait_for_startup.
+SERVER_STARTUP_TIMEOUT_S="${HG_SERVER_STARTUP_TIMEOUT_S:-120}"

Review Comment:
   ⚠️ `:-` treats an explicitly empty value as unset, so 
`HG_SERVER_STARTUP_TIMEOUT_S=` never reaches the regex below and silently 
becomes 120. Driving this entrypoint with a stubbed `bin/`: empty exits 0 with 
`-t 120`, while `0`, `+5` and a whitespace-only value are all rejected. That 
contradicts the README text added in this PR (lines 161-163: a value that is 
not a positive whole number "stops the container at startup instead of silently 
falling back to the default"), and it reinstates the failure this PR exists to 
fix, since a deployment that believes it set 450 still dies at 120. The repo's 
own compose files use that interpolation style 
(`docker/docker-compose.yml:34`), so `HG_SERVER_STARTUP_TIMEOUT_S: 
${SOME_VAR:-}` yields an empty value whenever the host variable is unset.
   
   Dropping the colon makes an empty value fail the guard while an unset one 
still defaults. Verified: unset gives `-t 120`, empty exits 1, 450 gives `-t 
450`, and `docker-entrypoint-test.sh` still exits 0.
   
   ```suggestion
   SERVER_STARTUP_TIMEOUT_S="${HG_SERVER_STARTUP_TIMEOUT_S-120}"
   ```
   
   If you would rather keep empty meaning "unset", the README sentence needs to 
say so instead.



##
hugegraph-server/hugegraph-dist/docker/README.md:
##
@@ -144,3 +144,20 @@ native `HEALTHCHECK` instructions. `docker ps` shows real 
health status:
 | `hugegraph/hugegraph-store` | `GET /v1/health` on port 8520 |
 
 The entrypoints supervise the Java process directly — when Java exits, the 
container exits. If started with a restart policy (the provided compose files 
use `restart: unless-stopped`), Docker will bring it back automatically. The 
old cron-based monitor (`-m true`) is for VM/bare-metal deployments only and is 
not used in Docker images.
+
+## 7. Server Startup Timeout
+
+The entrypoint gives the Server a fixed budget to answer on its REST port and
+ends the container when the budget runs out. 

Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-02 Thread via GitHub


imbajin commented on code in PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#discussion_r3919676942


##
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##
@@ -98,6 +98,19 @@ if [[ -n "${HG_SERVER_AUTH_TOKEN_SECRET:-}" ]]; then
 fi
 fi
 
+# How long the entrypoint lets the server take to answer on its REST port
+# before it gives up and ends the container. An orchestrator that already
+# owns this budget through a startup probe needs to raise it, otherwise the
+# container terminates a JVM that is still starting and the probe never gets
+# to decide. Validated here so a typo fails before init-store runs, rather
+# than reaching the arithmetic in wait_for_startup.
+SERVER_STARTUP_TIMEOUT_S="${HG_SERVER_STARTUP_TIMEOUT_S:-120}"
+if [[ ! "${SERVER_STARTUP_TIMEOUT_S}" =~ ^[1-9][0-9]*$ ]]; then

Review Comment:
   ⚠️ `HG_SERVER_STARTUP_TIMEOUT_S` accepts any positive integer, but 
`wait_for_startup` computes `stop_s=$((now_s + timeout_s))` (the shared 
`util.sh` implementation). With the documented input `9223372036854775807`, 
Bash overflows that sum to a negative value, so the loop is skipped and the 
container reports a startup timeout immediately instead of honoring the 
configured budget. Please reject values that cannot be safely added to the 
current epoch or use overflow-safe/saturating deadline arithmetic, and add a 
boundary test.



-- 
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]



Re: [PR] fix(docker): make the Server startup timeout configurable [hugegraph]

2026-09-02 Thread via GitHub


codecov[bot] commented on PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#issuecomment-5514328729

   ## 
[Codecov](https://app.codecov.io/gh/apache/hugegraph/pull/3187?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 34.74%. Comparing base 
([`98477f0`](https://app.codecov.io/gh/apache/hugegraph/commit/98477f0f56a3ad49593ec7632f2f0ee13e72f0dd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`5cad9dc`](https://app.codecov.io/gh/apache/hugegraph/commit/5cad9dc8217f0aa8139eb68ac1e32c6ab2af0df6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   Additional details and impacted files
   
   
   
   ```diff
   @@ Coverage Diff  @@
   ## master#3187  +/-   ##
   
   - Coverage 37.78%   34.74%   -3.05% 
   + Complexity 6556 4855-1701 
   
 Files   800  591 -209 
 Lines 6892955545   -13384 
 Branches   9157 7647-1510 
   
   - Hits  2604619299-6747 
   + Misses3982433836-5988 
   + Partials   3059 2410 -649 
   ```
   
   
   [:umbrella: View full report in Codecov by 
Harness](https://app.codecov.io/gh/apache/hugegraph/pull/3187?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   :loudspeaker: Have feedback on the report? [Share it 
here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:rocket: New features to boost your workflow: 
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   


-- 
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]