Skip to content

[#1030] Keep the setup log out of the way of start-ds, and say when it is gone - #1032

Open
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issues/1030-setup-log-survives-start-ds
Open

[#1030] Keep the setup log out of the way of start-ds, and say when it is gone#1032
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issues/1030-setup-log-survives-start-ds

Conversation

@vharseko

Copy link
Copy Markdown
Member

Fixes #1030

What was wrong

Since #576 the launcher scripts put java.io.tmpdir at <instance>/tmp, and start-ds did rm -rf tmp/* before starting the server. Setup starts the server through start-ds, so its own opendj-setup-*.log was unlinked mid-run on every setup; a start that failed afterwards named a file that was no longer there and printed a NoSuchFileException stack instead of the log. In the non-verbose mode the server: … lines that say why the server did not come up go only into that log, so the one place the diagnosis lived was the deleted file. Analysis and reproduction in #1030.

What changes

  1. start-ds / start-ds.bat — the sweep is narrowed to the bc-fips-jni_* directories the BC FIPS native loader extracts on every start (the name is "%s_%d" with module name bc-fips-jni, from LoaderUtils in bc-fips 2.1.3), which is what [#575] Set OpenDJ tmp dir to an installation directory #576 introduced it for. Other files in tmp/ belong to tools that may still be running. The .bat block becomes a single for /D … rmdir line, so the parse-time parenthesis problem the old block had to guard against does not arise.
  2. TempLogFile.newTempLogFile(prefix, directory) — the log can be placed in a directory of the caller's choosing (created if needed, fallback to java.io.tmpdir when null or unusable). SetupLauncher puts the setup log under <instance>/logs, next to server.out. Uninstall and the embedded server keep using the temporary directory.
  3. Installer.notifyListenersOfExistingLogFile — checks TempLogFile.isReadable() before promising the file; a missing log is reported with INFO_GENERAL_LOG_IN_ERROR_MISSING, a read failure with INFO_GENERAL_LOG_IN_ERROR_UNREADABLE, both to the listeners; printStackTrace() is gone.
  4. build.yml — a failure()-only step prints opendj*/logs/server.out and logs/errors of the instances a failed test step leaves behind; the server-side reason of a failed start is nowhere else.

Verification

  • TempLogFileTest (new, 5 tests): the directory is created, readContents() returns the file, isReadable() follows the file rather than the logger, fallback to the temporary directory for null and for an unusable directory. Neighbouring InstallationTest, ServerControllerTest, UtilsTest green (47/47).
  • On the built package, macOS:
    • LDAP port taken after "Configuring Certificates" (the Setup: a failed installation asks for a log file it has not checked is there, and prints a stack trace instead of saying so #1030 reproduction): Error code: 1, See …/logs/opendj-setup-*.log, the dumped log carries server: … unable to bind to 0.0.0.0:31389: IOException(Address already in use), no stack trace, exit code 7 as before; tmp/: a bc-fips-jni_123 directory removed, an unrelated opendj-replication-*.log kept.
    • The log removed behind setup's back: "The log file … of the failed operation is no longer there, so it cannot be provided with the error report." — no stack trace.
    • Plain successful setup: exit 0, no opendj-setup-*.log left in logs/, tmp/ untouched.
  • start-ds.bat is exercised by the "Test on Windows" step and the MSI jobs.

…t-ds, and say when it is gone

Since OpenIdentityPlatform#576 the launcher scripts put java.io.tmpdir at <instance>/tmp and
start-ds sweeps that directory clean before starting the server. Setup
starts the server through start-ds, so its own log went with the sweep on
every run; a start that failed afterwards named a file that was no longer
there and printed a NoSuchFileException stack instead of the log.

- start-ds / start-ds.bat: remove only the bc-fips-jni_* directories the
  BC FIPS native loader extracts on every start, which is what the sweep
  was introduced for; other files in tmp belong to tools that may still
  be running.
- TempLogFile can be placed in a directory of the caller's choosing;
  SetupLauncher puts the setup log under <instance>/logs, next to
  server.out, falling back to the temporary directory when the launcher
  does not run from an installation or the directory cannot be used.
- Installer checks that the log is readable before promising it, and
  reports a missing or unreadable log to the listeners instead of
  printStackTrace().
- build.yml: on a failed test step, print logs/server.out and logs/errors
  of the instances left behind - the server-side reason of a failed start
  is nowhere else.

Fixes OpenIdentityPlatform#1030
@vharseko vharseko added bug setup setup / upgrade / uninstall tools (quicksetup) and the launcher scripts CI tests Test suites: fixing, enabling, un-disabling labels Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug CI setup setup / upgrade / uninstall tools (quicksetup) and the launcher scripts tests Test suites: fixing, enabling, un-disabling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup: a failed installation asks for a log file it has not checked is there, and prints a stack trace instead of saying so

1 participant