Skip to content

Commit d854d17

Browse files
[ScanDaemon] Increase the timeouts in daemon
Increase the timeout in clang scan daemon for both connecting to a just launched daemon (due to possibility of hitting validation and pruning) and daemon lifetime timeout (due to possibility of large gaps between tasks in the same session). Also adjust the error message for connection timeout to make it more obvious. rdar://164491940
1 parent a4d76da commit d854d17

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

clang/tools/driver/cc1depscanProtocol.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ Expected<ScanDaemon> ScanDaemon::connectToDaemon(StringRef BasePath,
117117
if (!Socket)
118118
return reportError(Socket.takeError());
119119

120-
// Wait up to 30 seconds.
121-
constexpr int MaxWait = 30 * 1000 * 1000;
120+
// Wait up to 60 seconds.
121+
constexpr int MaxWait = 60 * 1000 * 1000;
122122
int NextBackoff = 0;
123123
int TotalBackoff = 0;
124124
while (TotalBackoff < MaxWait) {
@@ -139,8 +139,9 @@ Expected<ScanDaemon> ScanDaemon::connectToDaemon(StringRef BasePath,
139139
std::error_code(errno, std::generic_category())));
140140
}
141141

142-
return reportError(
143-
llvm::errorCodeToError(std::error_code(ENOENT, std::generic_category())));
142+
return llvm::createStringError(
143+
std::make_error_code(std::errc::timed_out),
144+
"timeout when connecting to scan daemon on path: '" + BasePath + "'");
144145
}
145146

146147
Expected<ScanDaemon> ScanDaemon::launchDaemon(StringRef BasePath,

clang/tools/driver/cc1depscan_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ int cc1depscand_main(ArrayRef<const char *> Argv, const char *Argv0,
768768
reportError("unknown command '" + Command + "'");
769769
}
770770

771-
Server.TimeoutSeconds = LongRunning ? 45 : 15;
771+
Server.TimeoutSeconds = LongRunning ? 120 : 15;
772772

773773
// Daemonize.
774774
if (::signal(SIGHUP, SIG_IGN) == SIG_ERR)

0 commit comments

Comments
 (0)