[PATCH] testbot: Requeue the task in case the script gets stuck.

Francois Gouget fgouget at codeweavers.com
Mon May 14 06:21:30 CDT 2018


Count how many times the task has been requeued to avoid infinite loops,
just like the scripts themselves normally do.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/WineTestBot/Tasks.pm | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/testbot/lib/WineTestBot/Tasks.pm b/testbot/lib/WineTestBot/Tasks.pm
index 72dd3ff23..36cbfadbe 100644
--- a/testbot/lib/WineTestBot/Tasks.pm
+++ b/testbot/lib/WineTestBot/Tasks.pm
@@ -165,11 +165,25 @@ sub UpdateStatus($$)
       close TASKLOG;
     }
     umask($OldUMask);
-    # This probably indicates a bug in the task script.
-    # Don't requeue the task to avoid an infinite loop.
+
     require WineTestBot::Log;
     WineTestBot::Log::LogMsg("Child process for task $JobId/$StepNo/$TaskNo died unexpectedly\n");
-    $self->Status("boterror");
+
+    # A crash probably indicates a bug in the task script but getting stuck
+    # could happen due to network issues. So requeue the task like its script
+    # would and count attempts to avoid getting into an infinite loop.
+    if ($self->CanRetry())
+    {
+      $Status = "queued";
+      $self->TestFailures(($self->TestFailures || 0) + 1);
+      $self->Started(undef);
+      $self->Ended(undef);
+    }
+    else
+    {
+      $Status = "boterror";
+    }
+    $self->Status($Status);
     $self->Save();
 
     if ($VM->Status eq "running")
@@ -181,8 +195,6 @@ sub UpdateStatus($$)
       $VM->RecordResult(undef, "boterror process died");
     }
     # else it looks like this is not our VM anymore
-
-    $Status = "boterror";
   }
   elsif ($Skip && $Status eq "queued")
   {
-- 
2.17.0




More information about the wine-devel mailing list