Bug 1408224 - Avoid confusing errors in automation logs when failing to purge toolchain cache. r?mshal draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 13 Oct 2017 09:15:55 +0900
changeset 679786 edade87cfc37c59480692aefd48f965b8aed6684
parent 679629 25aad10380b10b6efa50c2b4d97245f078d870a0
child 735668 97c9f62aa9acb705b3fb15728c1490594f049df5
push id84297
push userbmo:mh+mozilla@glandium.org
push dateFri, 13 Oct 2017 00:22:31 +0000
reviewersmshal
bugs1408224, 1391811, 1408212
milestone58.0a1
Bug 1408224 - Avoid confusing errors in automation logs when failing to purge toolchain cache. r?mshal For some reason, Windows builders are setup in a way that prevents a task from purging the toolchain cache of old files. Until that is figured out and fixed, all the error message related to that achieves is confuse people because the treeherder Failure Classification tab shows them first. Practically speaking, the error doesn't prevent anything from working properly. The worst that can happen is disk space running out because of the toolchain cache being filled up, which would lead to actual errors. As the error happens on very many windows build, that leads to a lot of errors being bucketed on bug 1391811, while they may well be varying unrelated issues. It also leads to people thinking their try builds fail because of that, when they aren't (e.g. bug 1408212).
python/mozbuild/mozbuild/artifacts.py
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -739,17 +739,23 @@ class ArtifactPersistLimit(PersistLimit)
         files = sorted(self.files, key=lambda f: f.stat.st_atime)
         kept = []
         while len(files) > self.file_limit and \
                 self._files_size >= self.size_limit:
             f = files.pop(0)
             if f.path in self._downloaded_now:
                 kept.append(f)
                 continue
-            fs.remove(f.path)
+            try:
+                fs.remove(f.path)
+            except WindowsError:
+                # For some reason, on automation, we can't remove those files.
+                # So for now, ignore the error.
+                kept.append(f)
+                continue
             self.log(logging.INFO, 'artifact',
                 {'filename': f.path},
                 'Purged artifact {filename}')
             self._files_size -= f.stat.st_size
         self.files = files + kept
 
     def remove_all(self):
         from dlmanager import fs