Francois Gouget : testbot/Engine: Prevent recursion into ScheduleJobs().
Alexandre Julliard
julliard at winehq.org
Fri Jun 17 03:13:00 CDT 2022
Module: tools
Branch: master
Commit: 399c4bedd782326bba65b0944caeaf91df65a7ef
URL: https://source.winehq.org/git/tools.git/?a=commit;h=399c4bedd782326bba65b0944caeaf91df65a7ef
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Fri Jun 17 10:09:27 2022 +0200
testbot/Engine: Prevent recursion into ScheduleJobs().
Recursion may happen through the ScheduleJobs() -> VM::Run() ->
VMStatusChange() -> ScheduleJobs() chain.
It can cause multiple revert processes to run on the same VM, or even a
revert process to run at the same time as a task.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/lib/WineTestBot/Engine/Scheduler.pm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/testbot/lib/WineTestBot/Engine/Scheduler.pm b/testbot/lib/WineTestBot/Engine/Scheduler.pm
index cc2ea1f1..1b21ab97 100644
--- a/testbot/lib/WineTestBot/Engine/Scheduler.pm
+++ b/testbot/lib/WineTestBot/Engine/Scheduler.pm
@@ -945,6 +945,7 @@ sub _PowerOffDirtyVMs($)
}
}
+my $_InScheduleJobs;
my $_LastTaskCounts = "";
=pod
@@ -1003,6 +1004,11 @@ kept on standby so they are ready when their turn comes.
sub ScheduleJobs()
{
+ # Don't let Engine notifications (specifically VMStatusChange) cause
+ # recursion into ScheduleJobs().
+ return if ($_InScheduleJobs);
+ $_InScheduleJobs = 1;
+
my $Sched = _CheckAndClassifyVMs();
my $NeededVMs = _ScheduleTasks($Sched);
_RevertVMs($Sched, $NeededVMs);
@@ -1052,6 +1058,8 @@ sub ScheduleJobs()
$Timeout = 600;
}
AddEvent("ScheduleJobs", $Timeout, 0, \&ScheduleJobs);
+
+ $_InScheduleJobs = undef;
}
More information about the wine-cvs
mailing list