Module: tools
Branch: master
Commit: a45ffb01723a651ceafb86e8cbb00d6d44f1cdff
URL: https://source.winehq.org/git/tools.git/?a=commit;h=a45ffb01723a651ceafb86e…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Mon Jun 20 18:23:57 2022 +0200
testbot/Engine: Don't schedule jobs until the initialization is done.
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(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
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 9d836529..39577d14 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 1b21ab97..f91bf3fd 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