Commit 716b43ff authored by Erik Jensen's avatar Erik Jensen Committed by Commit Bot

Return success on Linux when host start times out.

On Linux, the user-session binary, after forking the host deamon, keeps
running in the foreground to relay log messages and return the ultimate
success/failure of starting the host to the caller. However, if the host
takes more than 120 seconds to signal it is online, the foreground
process will time out and quit, leaving the background process running.

With this commit, the foreground process will optimistically return
success to the calling process in this case, rather than failure as it
did previously. This allows the setup flow to be completed even when
replication delays or other issues cause the host to take a long time to
start, as an error return code during initial setup would cause the host
to be automatically unregistered from the directory.

Change-Id: Ie8d157cf2bc433a59857b65b495cc79aeea63ffc
Reviewed-on: https://chromium-review.googlesource.com/1086386Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Commit-Queue: Erik Jensen <rkjnsn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565092}
parent 7ae2f35b
...@@ -551,7 +551,10 @@ void HandleAlarm(int) { ...@@ -551,7 +551,10 @@ void HandleAlarm(int) {
// Use write since fputs isn't async-signal-handler safe. // Use write since fputs isn't async-signal-handler safe.
ignore_result(write(STDERR_FILENO, kTimeoutMessage, ignore_result(write(STDERR_FILENO, kTimeoutMessage,
arraysize(kTimeoutMessage) - 1)); arraysize(kTimeoutMessage) - 1));
std::_Exit(EXIT_FAILURE); // A slow system or directory replication delay may cause the host to take
// longer than expected to start. Since it may still succeed, optimistically
// return success to prevent the host from being automatically unregistered.
std::_Exit(EXIT_SUCCESS);
} }
// Relay messages from the host session and then exit. // Relay messages from the host session and then exit.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment