mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
7 hours ago c88f9abb38f0a17db2aaa71030756276cc23e404
refs
author Valery Kharseko <vharseko@3a-systems.ru>
Saturday, November 21, 2026 14:52 +0100
committer GitHub <noreply@github.com>
Saturday, November 21, 2026 14:52 +0100
commitc88f9abb38f0a17db2aaa71030756276cc23e404
tree 7a929fd11a5af0a111486e4ad6f3b01e378e10cf tree | zip | gz
parent 077abc8699cb5915a888a30d0d3f7c4b4ef88ac3 view | diff
[#1318] Wait for Unix startup and shutdown in the shell (#1319)

Fixes #1318

## Changes

- Share a shell wait loop between Unix detached `start-ds` and local
`stop-ds`. The wait ends when the corresponding startup marker or PID
file disappears.
- Preserve startup log forwarding, quiet mode, the validated startup
timeout, and the final startability check. If the server child exits
before readiness, report its exit status, including when setup passes
`--timeout 0`. Waiting still works when `server.out` cannot be opened
for reading.
- Keep the Java stoppability preflight, `SIGTERM`, the 200-second local
shutdown timeout, quiet restart, and LDAP fallback. Forward new
`logs/errors` data from the open descriptor, including the final lines
when the log rotates during shutdown.
- Use `stat` on the open shutdown log descriptor and a one-byte `dd`
read at the end before sending `SIGTERM`. The same descriptor forwards
new bytes during log rotation. If log positioning fails, continue the
shutdown without forwarding the log.

## Validation

- Ran the Unix launcher self-test with `dash`, `ksh`, macOS `sh`, and
BusyBox `sh` on Alpine. It covers successful startup, early child exit,
timeout, quiet mode, the final probe, and unreadable startup logs. The
fixture checks that the Java startup preflight receives `-t1` as a
distinct argument.
- Added shutdown cases for new log output, rotation before PID file
removal, an unreadable log, quiet restart, and timeout followed by LDAP
fallback. The 64 GiB sparse-log case rejects an unbounded read, and the
failed-`stat` case verifies that shutdown still completes.
- Verified local shutdown on a packaged server with JDK 21. `stop-ds`
returned `0` after an LDAP readiness check, `server.pid` disappeared,
and the Java trace showed only `--checkStoppability`.
- Earlier JDK 21 validation of the detached startup change covered a
live child timing out through the real Java preflight and a successful
startup with `server.out` mode `0200`. All 20 tests in the three
targeted Maven integration classes passed.
- Ran the updated launcher self-test under `dash` on Ubuntu 26.04 with
`uutils coreutils` 0.10.0, under `dash` and `ksh` on macOS, and under
BusyBox `sh` on Alpine. The checks cover stale log output, rotation, and
the 64 GiB sparse log.
- `git diff --check` and launcher syntax checks passed.
5 files modified
1 files added
619 ■■■■■ changed files
.github/scripts/selftest-detached-start.sh 330 ●●●●● diff | view | raw | blame | history
.github/workflows/build.yml 4 ●●●●● diff | view | raw | blame | history
opendj-server-legacy/resource/bin/_script-util.sh 64 ●●●●● diff | view | raw | blame | history
opendj-server-legacy/resource/bin/start-ds 106 ●●●●● diff | view | raw | blame | history
opendj-server-legacy/resource/bin/stop-ds 88 ●●●●● diff | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java 27 ●●●●● diff | view | raw | blame | history