Skip to content

Commit

Permalink
fix spwaning process bug in automatic eden doctor run
Browse files Browse the repository at this point in the history
Summary:
# problem
`eden doctor` automatic run is failing with below error-
```
EI1015 00:18:55.202938 116940 EdenServer.cpp:2767] Running periodic eden doctor dry-run.
E1015 00:18:55.203525 116940 SpawnedProcess.cpp:706] class std::system_error: CreateProcess("edenfsctl" "doctor" "--dry-run") failed with cwd: (no cwd provided), creation flags: 0, execPath: (no execPath provided): Error (0x57) The parameter is incorrect.
```

# solution
This is similar to D59783277.
We need to pass SpawnedProcess options while spawning a process with default params.

Reviewed By: genevievehelsel

Differential Revision: D64432742

fbshipit-source-id: 29ede06f4963112e4c4e0536fd99190d1cc7c3d8
  • Loading branch information
Saurav Prakash authored and facebook-github-bot committed Oct 17, 2024
1 parent df3916c commit d74007c
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions eden/fs/service/EdenServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2759,13 +2759,32 @@ void EdenServer::runEdenDoctor() {
// than reusing it. Explanation on why CPUThreadPoolExecutor-
// https://www.internalfb.com/intern/staticdocs/fbcref/guides/Executors/.
folly::CPUThreadPoolExecutor executor(1);
executor.add([] {
auto systemConfigDir = config_->getEdenConfig()->getSystemConfigDir();
auto edenDir = getEdenDir();
executor.add([systemConfigDir, edenDir] {
try {
XLOG(INFO, "Running periodic eden doctor dry-run.");
// Not passing Options field cause "0x57" error. ref: D59783277
SpawnedProcess::Options opts;
#ifdef _WIN32
opts.creationFlags(CREATE_NO_WINDOW);
opts.nullStderr();
opts.nullStdin();
opts.nullStdout();
#endif // _WIN32
// Assuming, this will only be run from windows user's system,
// we are using the plain vanilla version of eden doctor dry run.
// This can be modified in the future to pass config-dir param.
auto proc = SpawnedProcess({"edenfsctl", "doctor", "--dry-run"});
auto proc = SpawnedProcess(
{"c:\\tools\\eden\\bin\\edenfsctl.exe",
"--etc-eden-dir",
systemConfigDir.c_str(),
"--config-dir",
edenDir.asString(),
"doctor",
"--dry-run",
"--fast"},
std::move(opts));
XLOG(INFO, "Checking status for eden doctor dry-run.");
// Setting the timeout to terminate process to 2.5 minutes.
// P99.9 to run eden doctor dry-run is ~2 minutes.
Expand Down

0 comments on commit d74007c

Please sign in to comment.