From 0ab20e311f8607bdceb7485da51bf97520eda4b8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 3 Feb 2025 13:08:15 +0200 Subject: Handle out of disk space condition some more --- bbot/worker/worker.cxx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index 5a4d240..36c5e71 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -1339,6 +1339,7 @@ static const string worker_checksum ("5"); // Logic version. static int bbot:: build (size_t argc, const char* argv[]) +try { using std::map; using std::multimap; @@ -6348,7 +6349,7 @@ build (size_t argc, const char* argv[]) } break; - } + } // End "breakout" loop. if (!rm.results.empty ()) { @@ -6470,7 +6471,7 @@ build (size_t argc, const char* argv[]) } // // We use exit code 3 to signal an unsuccessful attempt to upload the result - // manifest and exit code 4 to singal that there was no disk space to + // manifest and exit code 4 to signal that there was no disk space to // serialize the manifest. See startup() for details. // catch (const io_error& e) @@ -6487,6 +6488,23 @@ build (size_t argc, const char* argv[]) return 4; } } +catch (const system_error& e) +{ + // This can be, for example, io_error due to the inability to flush the + // logs. + // + if (e.code ().category () == std::generic_category () && + e.code ().value () == ENOSPC) + { + error << "no space left on device"; + return 4; + } + else + { + error << "unexpected system error: " << e; + return 1; // Abnormal, no result manifest uploaded. + } +} // Parse the task_manifest::auxiliary_environment value into the list of // environment variable assignments as expected by the process API. Throw @@ -6801,6 +6819,9 @@ startup () // Exit code 4 signals the inability to serialize the result manifest due // to insufficient disk space. // + // Note that in case of abnormal termination, run_io_exit() throws failed + // which is handled the same as exit code 1. + // switch (run_io_exit (trace, 0 /* stdin */, 2 /* stdout */, 2 /* stderr */, process_env (pp, aux_env), -- cgit v1.1