[4/4] testbot/CheckForWinetestUpdate: Plug a staging file leak in case no job actually needs it.

Francois Gouget fgouget at codeweavers.com
Tue May 6 19:35:01 CDT 2014


The leak would happen whenever there was no non-base VM for instance.
---

This fixes part of the leaks that lead to the opening of bug 35576.
http://bugs.winehq.org/show_bug.cgi?id=35576

On my box it was responsible for a 10GB leak! The WineTest binaries are 
big (particularly the 64-bit one, 58MB).

 testbot/bin/CheckForWinetestUpdate.pl | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl
index 98165a3..093b281 100755
--- a/testbot/bin/CheckForWinetestUpdate.pl
+++ b/testbot/bin/CheckForWinetestUpdate.pl
@@ -112,7 +112,9 @@ sub AddJob
     }
 
     $NewStep->HandleStaging($NewJob->Id);
+    return 1;
   }
+  return 0;
 }
 
 sub AddReconfigJob
@@ -230,11 +232,16 @@ if (! copy($StagingFileName, $LatestFileName))
 }
 utime time, $Response->last_modified, $LatestFileName;
 
-if ($Bits == 32)
+
+AddReconfigJob() if ($Bits == 32);
+
+if (!AddJob(1, $FileNameRandomPart, $Bits) and !unlink($StagingFileName))
 {
-  AddReconfigJob();
-  AddJob(1, $FileNameRandomPart, $Bits);
+  LogMsg "Could not delete '$StagingFileName': $!\n";
+}
 
+if ($Bits == 32)
+{
   # Create another copy for the non-base VMs Job.
   $FileNameRandomPart = GenerateRandomString(32);
   while (-e "$DataDir/staging/${FileNameRandomPart}_winetest-latest.exe")
@@ -246,15 +253,11 @@ if ($Bits == 32)
   {
     LogMsg "Can't copy $LatestFileName to $StagingFileName: $!\n";
   }
-  else
+  elsif (!AddJob(!1, $FileNameRandomPart, $Bits) and !unlink($StagingFileName))
   {
-    AddJob(!1, $FileNameRandomPart, $Bits);
+    LogMsg "Could not delete '$StagingFileName': $!\n";
   }
 }
-else
-{
-  AddJob(1, $FileNameRandomPart, $Bits);
-}
 
 RescheduleJobs();
 
-- 
2.0.0.rc0



More information about the wine-patches mailing list