Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

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


34 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. Unknown User (cpt_giggles)

      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. Unknown User (mgricken)

    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. Unknown User (orrc)

    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. Unknown User (gpavek)

    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. Unknown User (aveckey)

    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. Unknown User (icasimpan)

    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. Unknown User (mmacvicar)

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

  7. Unknown User (everydayjenkinsuser)

    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. Unknown User (nnau)

    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. Unknown User (mcote)

    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. Unknown User (anthonyjeffery)

    We would also like to see this enhancement.

  11. Unknown User (cinquero)

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

  12. Unknown User (sodul)

    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. Unknown User (soundrabbit)

    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. Unknown User (soundrabbit)

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

  15. Unknown User (alex01ves)

    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. Unknown User (sergtk)

    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. Unknown User (schleprock)

    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. Unknown User (fschott)

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

      1. Unknown User (gaborcsardi)

        Same problem here. Version 1.533, plugin version 1.12

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

      2. Unknown User (schleprock)

        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. Unknown User (rmahadev)

    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. Unknown User (walterk82)

    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. Unknown User (vishalrekala)

    How do i download this plugin?  

    I don't see it in jenkins plugin manager.

  21. Unknown User (stenver)

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

  22. Unknown User (zhangyachuan)

    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. Unknown User (yang928)

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

  24. Unknown User (xge)

    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

  25. Unknown User (hyei)

    You can use the EnvInject plugin to do this. Check your conditional and save your to custom timeout value into a variable in Java property file format in a file in the workspace under the "Script Content" section of "Prepare an environment for the run", load the properties file in "Properties File Path", and use that variable in "Timeout minutes" section of the job.

  26. Unknown User (savithari)

    Nice plugin folks:

    Thank you in advance for your timer and attention.


    Please help me understand something.

    The picture here shows the flow I have.



    I am expecting JobA and JobC to get aborted since the time of 3 minutes was exceeded.
    Is that an incorrect understanding ?

    If it indeed cannot abort the jobs,  especially blocking ones, what are my options ?
    Should I use the post build step and go thru the running jobs of the child, in this case for JobC for the specific parameter and abort that manually ?
    If so how do I abort the job ?  Is there a plugin for that ?

    Thank you for your time and attention.
    -N