Codesign: Possible fix for stamp appearing prior to archive
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 4 Feb 2020 08:47:59 +0000 (09:47 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 4 Feb 2020 08:47:59 +0000 (09:47 +0100)
From looking into builder's logs it seems that stamp file is picked
up prior to actual archive: sometimes worker reports missing archive
file, from a code path which is only possible if there is a stamp file.

Could be something with IO scheduling where bigger file is sent to
Samba server after smaller file.

Hopefully with this change this will not happen anymore.

build_files/buildbot/codesign/archive_with_indicator.py

index 51bcc28520def17d6701fe0359681770885ac0c4..0574c964612553d674326a36e8759f25607d5015 100644 (file)
@@ -18,6 +18,7 @@
 
 # <pep8 compliant>
 
+import os
 from pathlib import Path
 
 from codesign.util import ensure_file_does_not_exist_or_die
@@ -82,6 +83,10 @@ class ArchiveWithIndicator:
               If it is violated, an assert will fail.
         """
         assert not self.is_ready()
+        # Try the best to make sure everything is synced to the file system,
+        # to avoid any possibility of stamp appearing on a network share prior to
+        # an actual filr.
+        os.sync()
         self.ready_indicator_filepath.touch()
 
     def clean(self) -> None: