Skip to end of metadata
Go to start of metadata

Plugin Information

View Build Timeout on the plugin site for more information.

This plugin allows you to automatically abort a build if it's taking too long.Once the timeout is reached, Jenkins behaves as if an invisible hand has clicked the "abort build" button.

This plugin isn't applicable to pipelines.
Use timeout step in workflow-basic-steps instead.

Instructions:

After installing the plugin, go to the configure page for your job and select "Abort the build if it's stuck".

Because Java only allows threads to be interrupted at a set of fixed locations, depending on how a build hangs, the abort operation might not take effect. For example,

  • if Jenkins is waiting for child processes to complete, it can abort right away.
  • if Jenkins is stuck in an infinite loop, it can never be aborted.
  • if Jenkins is doing a network or file I/O within the Java VM (such as lengthy file copy or SVN update), it cannot be aborted.

So if you think the build time out isn't taking effect, our default assumption is that the build is hanging at the place that cannot be interrupted. If you suspect otherwise, please obtain the thread dump and report it.

Time-out actions with notes

Time-out action

Note

Abort and restart the build

Installing Naginator Plugin enables this action

History

Version 1.19 (Oct 8, 2017)

  • Targets Jenkins 1.625.1 (Pull request #64)
    • You no longer need matrix-project plugin and so on to install build-timeout plugin
  • Improved Japanese translations (Pull request #63)

Version 1.18 (Nov 13, 2016)

  • Introduced "Run with timeout" build step (PR61)

Version 1.17.1 (Jul 19, 2016)

  • Fixed: a stacktrace is output when Jenkins launches without naginator-plugin (JENKINS-36696)

Version 1.17 (Jun 26, 2016)

  • A new time-out action: Abort and restart the build (JENKINS-8947)
  • Clarified the help text of 'likely stuck' (#48)
  • The previous help text simply referenced the source code, which isn't helpful for most users.

Version 1.16.1 (Jun 20, 2016)

  • No change from 1.16.
  • Just to suppress the wrong version in the update center (#56)

Version 1.16 (Jan 24, 2015)

  • Introduced fail safe timeout duration for ElasticTimeOutStrategy (JENKINS-30564).

Version 1.15.1 (Nov 21, 2015)

Version 1.15 (Jul 26, 2015)

Version 1.14.1 (Jan 03, 2015)

  • FIXED: timeout actions don't defaults to 'abort build' when no option is selected (JENKINS-23740)
  • Added license notice (MIT) (JENKINS-21270)
  • Improved the performance of NoActivityTimeOutStrategy (JENKINS-26170)

Version 1.14 (Jun 01, 2014)

  • Now targets Jenkins 1.466.
  • This version breaks binary compatibility.
    • This can affect you onlt in following cases (In other words, this does not affect most users)
      • When you have private plugins accessing inner information of Build-timeout plugin.
      • When you have groovy scripts accessing inner information of Build-timeout plugin.
  • Resolved a performance problem introduced in 1.13 by capturing log outputs. (JENKINS-23012)
  • Use dropdown for strategy instead of hetero-radio, as it can conflicts with other plugins. (JENKINS-20164)
  • FIXED: Enable BuildStep Action in System Configuration page was not saved to the disk. (JENKINS-23118)
  • Supported launcher in Perform Buildstep. (JENKINS-23117)
  • Allow use of ${...} style expressions in defining the build timeouts. (JENKINS-9457, JENKINS-19773, JENKINS-20526)

Version 1.13 (Mar 29, 2014)

  • Added "No Activity" timeout strategy, which triggers timeout when no log output for specified seconds. (JENKINS-13349)
  • Actions performed when timeout occurs can be extended using extension points. (issue #21919)
  • expose the build timeout milliseconds with an environment variable
  • "Perform BuildStep" timeout action is added. It allows you to trigger any build step when timeout.
    • It does not ensure any build steps work correctly.
    • As it is provided as an advanced feature, you need to enable it in System Configuration page to enable in project configuration pages.

Version 1.12.2 (Oct 14, 2013)

  • Fixed missing strategies selection when a new job is created (JENKINS-19592)
  • Fixed missing label selecting time-out strategy

Version 1.12 (Sep 7, 2013)

  • Fix elastic timout (pull #12).
  • Define an extension point for time-out strategy (pull #14).
  • Build Timeout Plugin configuration interface shows all sub options (JENKINS-18618).

Version 1.11 (Oct 28, 2012)

  • Change to build timeout job configuration not saved (JENKINS-14158).
  • Clarified timeoutMinutesElasticDefault's name (pull #11).

Version 1.10 (Jun 16, 2012)

  • Build timeout plugin 1.9 always sets timeout period to 3 minutes ([]).
  • updated to LTS 1.447
  • updated Japanese localization.

Version 1.9 (March 12, 2012)

  • amend build description on timeout
  • elastic timeout option to define timeout as a percent of previous build duration
  • "likely stuck" option

Version 1.8 (Aug 27, 2011)

  • Marking a build as failed works now as expected.
  • Japanese translation

Version 1.7 (Mar 20, 2011)

  • Clarify in help text that marking build as failed instead of aborted does still abort the build.
  • Write more detail in log when build is aborted.

Version 1.6 (Dec 28, 2009)

  • Remove debug output
  • Update uses of deprecated APIs

Version 1.5

  • Option to mark builds as failed or aborted.

Version 1.4

  • The plugin now works with the native maven2 job type as well as the matrix job type.

Issues

To report a bug or request an enhancement to this plugin please create a ticket in JIRA (you need to login or to sign up for an account). Also have a look on How to report an issue

Key T P Summary
Loading...
Refresh

 

32 Comments

  1. Unknown User (cbos.ec@gmail.com)

    A nice enhancement would be to send an email as well on abort. When a build takes more time then expected something is wrong, so an email would help. We have had a number of times that our build stuck and was aborted but no mail was send.

    1. The Jenkins plugin Email-ext provides editable email configuration. One of the settings you might take a look at is the Post-Build Trigger "Aborted" ( https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin ) I would guess it all depends on how this plugin marks a build aborted.

  2. It would be nice to run a script before the build is aborted. I am running xvfb and would like to take a screenshot of it using xwd before the build is aborted.

  3. It would also be great to have an "automatic" option that times-out after 150% (configurable) of the usual build time (averaged from the last N successful builds) has elapsed.

  4. Regarding the first comment above, to send an email on abort. Sounds like a good idea. One of my build scripts sends its own email, but when Hudson aborted the build, I could not find out why.

    The solution I implemented was to add a lot of console output to my build script. Hudson traps the console output and stores it with the test history regardless of outcome. This makes it possible to diagnose failures even when my build script cannot send its own email. The only problem I had to deal with then was that Ruby was caching the $stdout. Fixed that when I found the .sync and .flush methods for an iostream." $stdout.sync = true" became my new best friend but flushing might be better in other circumstances.

  5. I like the 'automatic' option described above.  It would also be helpful if there was a global setting, so that you can set a default timeout for all jobs instead of only setting on a per-job basis (with the option of overwriting the default per job).

  6. The wiki does not say where to configure the build timeout.

    You can go to (obviously) configure and look for the "Abort the build if it's stuck" and configure the number of minutes the build will be aborted. In my case, what I did was to get the last 10 builds, get the peak build time and add 10 mins to it.

    1. Thank you for explaining that. I couldn't find the option by searching for timeout and my eyes were starting to bleed.

  7. Does anyone else get this exception when the build actually aborts?

    what should i do in this case?

    FATAL: hudson.remoting.RequestAbortedException: java.net.SocketTimeoutException: Read timed out

    hudson.remoting.RequestAbortedException: hudson.remoting.RequestAbortedException: java.net.SocketTimeoutException: Read timed out
    at hudson.remoting.Request.call(Request.java:137)
    at hudson.remoting.Channel.call(Channel.java:661)
    at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:158)
    at $Proxy25.join(Unknown Source)
    at hudson.Launcher$RemoteLauncher$ProcImpl.join(Launcher.java:850)
    at hudson.Launcher$ProcStarter.join(Launcher.java:336)
    at hudson.tasks.Ant.perform(Ant.java:216)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:662)
    at hudson.model.Build$RunnerImpl.build(Build.java:177)
    at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:429)
    at hudson.model.Run.run(Run.java:1374)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:145)
    Caused by: hudson.remoting.RequestAbortedException: java.net.SocketTimeoutException: Read timed out

  8. Hi! It will be really good if this plugin could send e-mail after build abortion. Is it possible? 

    Is there already  jenkins issue about it? 

  9. would this enhancement be possible?  allow me to setup post-abort cleanup or cleanup on the way to abort actions.

    I would like a lockfile to get deleted if a job is aborted.  Thanks.

  10. We would also like to see this enhancement.

  11. The should be a timeout depending on how long the build console log has stalled (ie. no visible progress).

  12. We're experiencing issues with 1.9 where the timeout is always saved as 3m. Even the job config history plugin shows no diffs when we apply the change from 3m to 30m. Is this a known bug? We are reverting to 1.8 for now.

    update: known issue https://issues.jenkins-ci.org/browse/JENKINS-14105

  13. Unknown User (es developer)

    To send notification e-mail after job abort I use https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

  14. In the latest version, the "Fail the Build" option is only available for "Likely Stuck", but not for "Absolute" timeout. It used to work in earlier versions.

    Why is that? See also here: https://issues.jenkins-ci.org/browse/JENKINS-14158?focusedCommentId=165837#comment-165837

    1. oh i see that the email ext plugin can send mails after abort. that's good enough for me.

  15. How does this work with Matrix builds?

    If one of the labels is waiting in queue for a long time, will this plugin abort the parent build? The good behavior would be that it doesn't.

  16. After installing plugin I observe the following description near plugin in Jenkins -> Manage Jenkins -> Manage Plugin -> Installed:

    "This plugin allows builds to be automatically terminated after the specified amount of time has elapsed."

    Where can I specify amount of time?

    Thanks.

  17. the latest update removes all of the configuration for time out period lengths. prior to the update you could set either absolute, elastic or likely stuck with time out periods. all of that configuration appears to have been removed???? now the only items that are available are:

    Abort the build if it's stuck

     

    Fail the build

     

    http://burvmtestxp64:8080/view/Utilities/job/DailyBuild/configure

     

     

     

     

     

     

    Writing the build description

     

    so what happened to the other configs? used to be a very good plugin, not so much anymore.

    1. I have the same problem. No configuration visible at all. How long dies the timeout take? 

      1. Same problem here. Version 1.533, plugin version 1.12

        Here is a workaround: https://issues.jenkins-ci.org/browse/JENKINS-19592

      2. it appears to use the default time out of 3 minutes. which is unbelievably inconvenient when the job always takes more than 3 minutes. basically, all my jobs after the update, failed, always!

  18. Cannot specify Environment variable or job parameter in Build TimeOut Absolute minutes configure section

    It would be good to add that as same job can have different timeout as build parameter

    Can you please look into this

  19. I have a slight variation in that I want to notify via email or some other method that a build is taking a long time, but I do NOT want to abort the build.  Does anyone know if there is a plugin to accomplish this?

  20. How do i download this plugin?  

    I don't see it in jenkins plugin manager.

  21. It would be really nice, if you could also set the build to be success if the timeout happens

  22. HI  ,I ' m running the jenkins ,use the plugin ,but i set 30 minutes is abort  ,then follow this:Build timed out (after 30 minutes). Marking the build as failed.
    Build timed out (after 30 minutes). Marking the build as aborted.
    Build was aborted

    then the console is stop here ,loop ,this build isn't stop

  23. Can you make "Writing the build description" action as appending than adding, as it would override existed description?

  24. Is there a way where I can set different timeout based on the given value of parameters?

    For example, there is a parameter "X", then I would like to set the timeout with the logic:

    if X = 0:

        timeout = 60

    else

        timeout = 100