#1406 backend: use FileHandler for backend.log
Merged 3 years ago by praiskup. Opened 3 years ago by praiskup.

@@ -180,7 +180,7 @@

      def _setup_resultdir_and_logging(self):

          """ Prepare the result directory and log file ASAP """

          self._prepare_result_directory(self.job)

-         handler = logging.handlers.WatchedFileHandler(

+         handler = logging.FileHandler(

              filename=self.job.backend_log,

          )

          handler.setLevel(logging.INFO)

WatchedFileHandler isn't appropriate choice, that's not what we actually
need. But more importantly, it even caused problems on build cancel:

  1. user requested build cancel
  2. user requested build delete very quickly
  3. the build delete action was processed first, and build was removed
    (including the backend.log)
  4. cancel request is processed
  5. background worker tracebacks on the first attempt to log into the
    backend.log file because we don't only remove the log file, but whole
    directory.

Where WatchedFileHandler failed before to re-create the file, we simply
ignore the unlink()ed file problem and keep writing into the opened file
descriptor.

As a consequence, because of unexpected error in logging, we did not
even release the allocated VM before (so tickets were kept open, and
resources UP, and unused).

Pull-Request has been merged by praiskup

3 years ago