You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The update CLI command accepts --maxUpdateWaitTimeMs ("Timeout value to wait for update process to complete. Defaults to 30000 ms.", RemoteCommandScope.java:233-237) and carries it into UpdateCommandConfig.maxUpdateWaitTimeMs (:24, :261), but nothing ever reads it: getMaxUpdateWaitTimeMs() is referenced only from a Javadoc @see (UpdateCommand.java:710). WaitForInstallDoneStepExecutor polls the update log until a terminal status with no time limit at all, so the option is a silent no-op and the CLI can wait forever.
Found while analysing #219 (fixed by #221); kept separate because it is a different loop and a different decision.
while (!TERMINAL_STATE.contains(status)) {
log("Update procedure is still processing...");
Thread.sleep(config.getCheckCompleteFrequency());
...
status = response.getContent().get("status").defaultTo(UPDATE_STATUS_IN_PROGRESS).asString().toUpperCase();
}
if (TERMINAL_STATE.contains(status)) {
...
returnExecutorStatus.SUCCESS;
} else {
log("The update process failed to complete within the allotted time. " +
"Please verify the state of OpenIDM.");
returnExecutorStatus.FAIL;
}
The else branch is unreachable: the loop only exits when status is terminal. The startTime read from state.getStartInstallTime() (:728) is validated (startTime <= 0 → IllegalStateException) but never used for anything else.
This is not a regression on our side: upstream commit 9cc8612fd (OPENIDM-5529, 2016-04-06) removed the timeout = (System.currentTimeMillis() - startTime > config.getMaxUpdateWaitTimeMs()) evaluation from the loop when it added PENDING_REPO_UPDATES to TERMINAL_STATE, and in the same commit disabled the test that covered the timeout — UpdateCommandTest.testTimeoutInstallUpdateArchive is still there with //@Test (UpdateCommandTest.java:271). The CLI parameter, config setter, Javadoc and dead branch were left behind, so the tool still advertises a timeout it does not honour.
Suggested fix
Two consistent outcomes; either is better than the current state:
Honour the parameter. Check elapsed time (monotonic, via the WaitClock introduced in [#219] Make UpdateCommand job-wait loop verdict fresh and its test clock-independent #221) before each sleep and stop polling once maxUpdateWaitTimeMs is exceeded, then re-enable testTimeoutInstallUpdateArchive with the fake clock so it is deterministic. Note the current failure path is unsafe for this case: a FAIL from WAIT_FOR_INSTALL_DONE runs the recovery sequence (EXIT_MAINTENANCE_MODE, ENABLE_SCHEDULER, FORCE_RESTART) while the server-side install may still be in progress. A timeout should therefore stop waiting, print the update id and last status and exit non-zero, without running recovery — or the parameter should be documented as "give up waiting; the update continues on the server".
Drop the parameter. Remove --maxUpdateWaitTimeMs, UpdateCommandConfig.maxUpdateWaitTimeMs, the @see, the unreachable else branch and the dead test, and document that the CLI waits until the update reaches a terminal state.
Given that repo migrations can legitimately take longer than any fixed default and that upstream apparently removed the timeout on purpose, option 2 (or option 1 with the "stop waiting, do not recover" semantics) seems the safer direction; a 30 s default that triggers recovery mid-install would be worse than today's behaviour.
Environment
Branch: master (7.1.3-SNAPSHOT), line numbers as of e8073da65
Summary
The
updateCLI command accepts--maxUpdateWaitTimeMs("Timeout value to wait for update process to complete. Defaults to 30000 ms.",RemoteCommandScope.java:233-237) and carries it intoUpdateCommandConfig.maxUpdateWaitTimeMs(:24,:261), but nothing ever reads it:getMaxUpdateWaitTimeMs()is referenced only from a Javadoc@see(UpdateCommand.java:710).WaitForInstallDoneStepExecutorpolls the update log until a terminal status with no time limit at all, so the option is a silent no-op and the CLI can wait forever.Found while analysing #219 (fixed by #221); kept separate because it is a different loop and a different decision.
Root cause
WaitForInstallDoneStepExecutor.execute(UpdateCommand.java:737-759):The
elsebranch is unreachable: the loop only exits whenstatusis terminal. ThestartTimeread fromstate.getStartInstallTime()(:728) is validated (startTime <= 0→IllegalStateException) but never used for anything else.This is not a regression on our side: upstream commit
9cc8612fd(OPENIDM-5529, 2016-04-06) removed thetimeout = (System.currentTimeMillis() - startTime > config.getMaxUpdateWaitTimeMs())evaluation from the loop when it addedPENDING_REPO_UPDATEStoTERMINAL_STATE, and in the same commit disabled the test that covered the timeout —UpdateCommandTest.testTimeoutInstallUpdateArchiveis still there with//@Test(UpdateCommandTest.java:271). The CLI parameter, config setter, Javadoc and dead branch were left behind, so the tool still advertises a timeout it does not honour.Suggested fix
Two consistent outcomes; either is better than the current state:
WaitClockintroduced in [#219] Make UpdateCommand job-wait loop verdict fresh and its test clock-independent #221) before each sleep and stop polling oncemaxUpdateWaitTimeMsis exceeded, then re-enabletestTimeoutInstallUpdateArchivewith the fake clock so it is deterministic. Note the current failure path is unsafe for this case: aFAILfromWAIT_FOR_INSTALL_DONEruns the recovery sequence (EXIT_MAINTENANCE_MODE,ENABLE_SCHEDULER,FORCE_RESTART) while the server-side install may still be in progress. A timeout should therefore stop waiting, print the update id and last status and exit non-zero, without running recovery — or the parameter should be documented as "give up waiting; the update continues on the server".--maxUpdateWaitTimeMs,UpdateCommandConfig.maxUpdateWaitTimeMs, the@see, the unreachableelsebranch and the dead test, and document that the CLI waits until the update reaches a terminal state.Given that repo migrations can legitimately take longer than any fixed default and that upstream apparently removed the timeout on purpose, option 2 (or option 1 with the "stop waiting, do not recover" semantics) seems the safer direction; a 30 s default that triggers recovery mid-install would be worse than today's behaviour.
Environment
master(7.1.3-SNAPSHOT), line numbers as ofe8073da65openidm-shell