[tools] testbot/Engine: Don't schedule jobs until the initialization is done.

Francois Gouget fgouget at codeweavers.com
Mon Jun 20 11:23:57 CDT 2022


On startup the Engine starts processes to check the state of each VM,
marking them as dirty in the process. But the VM status change causes
ScheduleJobs() to be called through the VMStatusChange notification,
potentially before all check processes have been started.
So make sure no job is scheduled until the Engine is ready.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/Engine.pl                       |  1 +
 testbot/lib/WineTestBot/Engine/Scheduler.pm | 21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index 9d836529c3..39577d14ca 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -780,6 +780,7 @@ sub main()
 
   # Cleanup starts processes to update the VMs. Run ScheduleJobs() now so it
   # can detect if these processes get stuck.
+  StartJobScheduler();
   ScheduleJobs();
 
   # Check for patches that arrived while the server was off.
diff --git a/testbot/lib/WineTestBot/Engine/Scheduler.pm b/testbot/lib/WineTestBot/Engine/Scheduler.pm
index 1b21ab9742..f91bf3fd03 100644
--- a/testbot/lib/WineTestBot/Engine/Scheduler.pm
+++ b/testbot/lib/WineTestBot/Engine/Scheduler.pm
@@ -28,7 +28,7 @@ WineTestBot::Engine::Scheduler - Schedules the TestBot tasks
 =cut
 
 use Exporter 'import';
-our @EXPORT = qw(ScheduleJobs CheckJobs);
+our @EXPORT = qw(StartJobScheduler ScheduleJobs CheckJobs);
 
 use File::Copy;
 
@@ -945,7 +945,24 @@ sub _PowerOffDirtyVMs($)
   }
 }
 
-my $_InScheduleJobs;
+my $_InScheduleJobs = 1;
+
+=pod
+=over 12
+
+=item C<StartJobScheduler()>
+
+Job scheduling is disabled initially to let the Engine perform its
+initialization without interference.
+
+=back
+=cut
+
+sub StartJobScheduler()
+{
+  $_InScheduleJobs = undef;
+}
+
 my $_LastTaskCounts = "";
 
 =pod
-- 
2.30.2



More information about the wine-devel mailing list