From 1d590434ea2ff2409abb05179e26311df06d7db6 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Fri, 12 Jul 2013 18:35:47 -0700 Subject: [PATCH] client: Fix a race condition on system reboot when using a child process for detecting GPUs, add debugging support to child process. --- client/gpu_detect.cpp | 9 ++++++++- client/main.cpp | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/client/gpu_detect.cpp b/client/gpu_detect.cpp index 8139e9a78e..c5cb739dd0 100644 --- a/client/gpu_detect.cpp +++ b/client/gpu_detect.cpp @@ -437,6 +437,10 @@ int COPROCS::launch_child_process_to_detect_gpus() { int retval = 0; boinc_delete_file(COPROC_INFO_FILENAME); + for (i=0; i<300; ++i) { + if (!boinc_file_exists(COPROC_INFO_FILENAME)) break; + boinc_sleep(0.01); + } boinc_getcwd(dataDir); @@ -502,7 +506,10 @@ int COPROCS::launch_child_process_to_detect_gpus() { } for (i=0; i<300; ++i) { - if (!process_exists(prog)) break; + if (boinc_file_exists(COPROC_INFO_FILENAME) && + !process_exists(prog)) { + break; + } boinc_sleep(0.01); } diff --git a/client/main.cpp b/client/main.cpp index 2f641f0b6a..d3ffec120f 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -261,6 +261,17 @@ static void do_gpu_detection(int argc, char** argv) { boinc_install_signal_handlers(); gstate.parse_cmdline(argc, argv); + gstate.now = dtime(); + + int flags = + BOINC_DIAG_DUMPCALLSTACKENABLED | + BOINC_DIAG_HEAPCHECKENABLED | + BOINC_DIAG_TRACETOSTDOUT | + BOINC_DIAG_REDIRECTSTDERR | + BOINC_DIAG_REDIRECTSTDOUT; + + diagnostics_init(flags, "stdoutgpudetect", "stderrgpudetect"); + read_config_file(true); coprocs.detect_gpus(warnings);