You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "bitflicker64 (via GitHub)" <gi...@apache.org> on 2026/06/04 09:34:40 UTC
[PR] fix(pd,store): fix foreground mode exit code propagation in startup scripts [hugegraph]
bitflicker64 opened a new pull request, #3047:
URL: https://github.com/apache/hugegraph/pull/3047
Fix foreground mode in start-hugegraph-pd.sh and start-hugegraph-store.sh (chunks 2–3 of #3043)
## Purpose of the PR
- relates to #3043
## Main Changes
**Problem**
Both `start-hugegraph-pd.sh` and `start-hugegraph-store.sh` had no foreground
branch — the scripts always backgrounded Java with `exec ... &`, wrote `$!` to
the pid file, and exited 0, losing Java's exit code entirely. Docker/systemd
supervisors never saw a non-zero exit, so containers were never restarted on
Java crash.
**Fix**
Add `DAEMON="true"` default and `-d true|false` flag to getopts in both scripts.
Daemon branch keeps `exec ... &` with `$!` as before. Foreground branch writes
`$$` to the pid file **before** `exec` (exec replaces the shell with Java, so
`$$` == Java's PID after exec), then `exec java` without `&` so the process
blocks and Java's exit code propagates out directly.
No trap needed in the foreground branch — `exec` replaces the shell process with
Java, so signals from Docker/systemd go directly to Java without a wrapper to
forward through (unlike chunk 1 where `& + wait` required an explicit trap).
**Tests**
| Script | Test file | Tests | Baseline | After fix |
|---|---|---|---|---|
| `start-hugegraph-pd.sh` | `test-start-hugegraph-pd.sh` | 4 (daemon regression, foreground blocks, exit code 137, SIGTERM 143) | 3 passed, 9 failed | 12 passed, 0 failed |
| `start-hugegraph-store.sh` | `test-start-hugegraph-store.sh` | 4 (same) | 3 passed, 5 failed | 11 passed, 0 failed |
Both test scripts wired into `pd-store-ci.yml` (no backend guard needed — pd/store jobs always run).
Note: Store health check is skipped when PD is not running — handled gracefully with a warning, not a failure.
**What's NOT in this PR**
Docker entrypoints, HEALTHCHECK, and cron monitor removal are in chunks 4–8 (separate PR).
## Verifying these changes
- [x] Need tests and can be verified as follows:
- `test-start-hugegraph-pd.sh $PD_DIR` — 12 assertions, all pass after fix
- `test-start-hugegraph-store.sh $STORE_DIR` — 11 assertions, all pass after fix
## Does this PR potentially affect the following parts?
- [ ] Dependencies
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects
- [x] Nope
## Documentation Status
- [x] `Doc - No Need`
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] fix(pd,store): fg mode exit code propagation in startup scripts [hugegraph]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin merged PR #3047:
URL: https://github.com/apache/hugegraph/pull/3047
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] fix(pd,store): fix foreground mode exit code propagation in startup scripts [hugegraph]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3047:
URL: https://github.com/apache/hugegraph/pull/3047#issuecomment-4622243364
## [Codecov](https://app.codecov.io/gh/apache/hugegraph/pull/3047?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 0.07%. Comparing base ([`d6e6216`](https://app.codecov.io/gh/apache/hugegraph/commit/d6e62162224234b0ae7ec480bca7159e2a13d1d1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a6c38e8`](https://app.codecov.io/gh/apache/hugegraph/commit/a6c38e8c6dd1d7dca1a0b20eee5097fd7a349b45?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
> :exclamation: There is a different number of reports uploaded between BASE (d6e6216) and HEAD (a6c38e8). Click for more details.
>
> <details><summary>HEAD has 2 uploads less than BASE</summary>
>
>| Flag | BASE (d6e6216) | HEAD (a6c38e8) |
>|------|------|------|
>||3|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #3047 +/- ##
============================================
- Coverage 36.07% 0.07% -36.00%
+ Complexity 338 22 -316
============================================
Files 803 781 -22
Lines 68095 65712 -2383
Branches 8918 8515 -403
============================================
- Hits 24563 51 -24512
- Misses 40897 65659 +24762
+ Partials 2635 2 -2633
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/hugegraph/pull/3047?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).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org