Change By: Clinton Barr (24/Sep/14 3:22 PM)
Description: We are using the ParameterFactory, "for each property file, invoke one build," to create builds for a UI testing project. Lately (behavior started last week, no change to plugins or Jenkins version), the ParameterFactory does not stop generating sets of builds. After reaching the Parameterized Trigger build step, a correct number of builds are generated (about 72 builds of one project with different parameters), but after an undetermined amount of time between 1 and 10 minutes, another set of 72 builds are generated. This continues in a loop, without stopping, with an observed maximum of over 3000 builds of the same project.

More use case information on the parameterized trigger build step:
* Block until triggered projects finish=false
* Predefined parameters used=true
* Parameters from properties file used=true
* For every property file, invoke one build=true
** File pattern: "test_list/current_run/*.properties"
** Action to perform when no files found: Fail the build step

Logger output for "hudson.plugins.parameterizedtrigger":
{quote}
Sep 22, 2014 8:55:20 AM INFO hudson.plugins.parameterizedtrigger.FileBuildParameterFactory getParameters
null
Sep 22, 2014 8:55:20 AM INFO hudson.plugins.parameterizedtrigger.FileBuildParameterFactory getParameters
null
Sep 22, 2014 8:55:20 AM INFO hudson.plugins.parameterizedtrigger.FileBuildParameterFactory getParameters
null
Sep 22, 2014 8:55:20 AM INFO hudson.plugins.parameterizedtrigger.FileBuildParameterFactory getParameters
null
Sep 22, 2014 8:55:20 AM INFO hudson.plugins.parameterizedtrigger.FileBuildParameterFactory getParameters
null
Sep 22, 2014 8:55:20 AM INFO hudson.plugins.parameterizedtrigger.FileBuildParameterFactory getParameters
null
{quote}
(This continues for another ten minutes with the same regularity)


More information:
Rather than blocking the parent project until the test project finishes, we use a system Groovy script to monitor the progress of these tests and enforce a timeout on these projects, in an attempt to curb another problem we experience, project build hangs (the project never passes the "building on [node]" point). Here is the script used:
{code:java|title=Groovy|borderStyle=solid}
// Monitor Script
//
// Wait for tests to finish, only continue when all tests are longer running or timeout occurs.
//
import hudson.model.*

  try {
    def env = Thread.currentThread().executable.parent.builds[0].properties.get("envVars");
    def projectname = env['CHILD_PROJECT'];
    def suite = env['SUITE_NAME'];
    def timeout = env['TIMEOUT_IN_MINUTES'].toInteger();
    def defaults = [ 'Custom':60, 'Core':45, 'Active':90, 'ActiveFailing':60, 'Random':45, 'All':120, 'Missing':60 ];
    if (timeout == 0) { timeout = defaults[suite]; }
  
    def proj = hudson.model.Hudson.instance.getItem(projectname);
    println(projectname + " is in the queue: " + proj.isInQueue());
    println(projectname + " is building: " + isJobRunning(projectname));
    println("Waiting for " + projectname + " to finish with a timeout of " + timeout + " minutes.");

// Check if project is building every minute, print waiting message every 10 minutes
def count = 0;
boolean timedOut = false;
while (isJobRunning(projectname) || proj.isInQueue()) {
  count++;
  Thread.sleep(60000);
  if (count % 10 == 0) {
    println(projectname + " is still building and has been building for " + count + " minutes.");
    printActiveJobs(runningJobs(projectname), projectname);
  }
  if (count == timeout) {
        println(projectname + " is no longer building. Continuing with job...");
    timedOut = true;
    break;
  }
}
if (!timedOut) { println("All " + projectname + " jobs are done building."); }
else { println("TIMEOUT PERIOD REACHED: " + timeout + " minutes have passed."); }
  }
catch (err) {
  println("Exception: " + err);
}

def isJobRunning(jobname) {  
  runningJobs(jobname).find {
    if (it.toString().contains(jobname)) {
      return true;
    }
  }
  return false;
}

def printActiveJobs(list, name) {
  def logentry = "The following " + name +
      " builds are still running:\r\n";
  list.each {
    logentry += it.getDisplayName() + ", ";
  }
  println(logentry + "\r\n");
}

def runningJobs(jobname) {
  def myJobs = hudson.model.Hudson.instance.items.findAll{job -> 
  job.name==jobname} 
{code}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to