How to stop an unstoppable zombie job on Jenkins without restarting the server?

前端 未结 27 1518
南旧
南旧 2020-11-27 09:18

Our Jenkins server has a job that has been running for three days, but is not doing anything. Clicking the little X in the corner does nothing, and the console output log do

相关标签:
27条回答
  • 2020-11-27 09:33

    Once I encounterred a build which could not be stopped by the "Script Console". Finally I solved the problem with these steps:

    ssh onto the jenkins server
    cd to .jenkins/jobs/<job-name>/builds/
    rm -rf <build-number>
    restart jenkins
    
    0 讨论(0)
  • 2020-11-27 09:34

    I had same issue at the last half hour...

    Was not able to delete a zombie build running in my multi-branch pipeline. Even Server restarts by UI or even from commandline via sudo service jenkins restart did block the execution... The build was not stoppable... It always reapeared.

    Used Version: Jenkins ver 2.150.2

    I was very annoyed, but... when looking into the log of the build I found something intersting at the end of the log:

    The red marked parts are the "frustrating parts"... As you can see I always wanted to Abort the build from UI but it did not work...

    But there is a hyperlink with text Click here to forcibly terminate running steps...(first green one) Now I pressed the link...) After the link execution a message about Still paused appeared with another Link Click here to forcibily kill entire build (second green one) After pressing this link also the build finally was hard killed...

    So this seems to work without any special plugins (except the multibranch-pipeline build plugin itself).

    0 讨论(0)
  • 2020-11-27 09:34

    Have had the same problem happen to me twice now, the only fix sofa has been to restart the tomcat server and restart the build.

    0 讨论(0)
  • 2020-11-27 09:35

    Had this same issue but there was not stack thread. We deleted the job by using this snippet in the Jenkins Console. Replace jobname and buil dnumber with yours.

    def jobname = "Main/FolderName/BuildDefinition"
    def buildnum = 6
    Jenkins.instance.getItemByFullName(jobname).getBuildByNumber(buildnum).delete(); 
    
    0 讨论(0)
  • 2020-11-27 09:37

    I've looked at the Jenkins source and it appears that what I'm trying to do is impossible, because stopping a job appears to be done via a Thread interrupt. I have no idea why the job is hanging though..

    Edit:

    Possible reasons for unstoppable jobs:

    • 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.
    0 讨论(0)
  • 2020-11-27 09:38

    VERY SIMPLE SOLUTION

    The reason I was seeing this issue was incorrect http link on the page instead of https that should stop the job. All you need to do is to edit onclick attribute in html page, by following

    1. Open up a console log of the job (pipeline) that got hang
    2. Click whatever is available to kill the job (x icon, "Click here to forcibly terminate running steps" etc) to get "Click here to forcibly kill entire build" link visible (it's NOT gonna be clickable at the moment)
    3. Open the browser's console (use any one of three for chrome: F12; ctrl + shift + i; menu->more tools->developer tools)
    4. Locate "Click here to forcibly kill entire build" link manually or using "select an element in the page" button of the console
    5. Double click on onclick attribute to edit its value
    6. Append s to http to have https
    7. Press enter to submit the changes
    8. Click "Click here to forcibly kill entire build" link

    Use screenshot for reference

    0 讨论(0)
提交回复
热议问题