Search code examples
vnext

TFS 2017 (on premise) vNext Build stuck with status 'cancelling'


I have configured a build server for TFS 2017 and vNext build for my web application. This was working fine until yesterday. Suddenly I started getting the message "Waiting for an available agent" when I try to queue the build. Even if I hit cancel, the build is stuck with the status 'cancelling'.

vNext build issue

  • Agent pool is green. All demands match with the build expectation.
  • Have restarted the Agent service on the build server.
  • Also tried restarting the "Visual studio backgroud agent job service" as suggested in this question
  • Agent doesn't have any log file after build stopped working.

Has anyone faced / solved similar issue?


Solution

  • Just try below things to narrow down the issue:

    • Check if the agent machine is out of space.
    • Clean up the agent machine: Delete the file items under "_work" folder of the build agent.
    • Restart the TFS Server.
    • Restart the agent machine.
    • Change another available account for agent service, restart the service.
    • Re-configure the agent
    • Deploy a new agent. See Deploy an agent on Windows

    UPDATE:

    Based on your clarification, seems it's caused by "Visual studio Team Foundation backgroud job Agent" service.

    Generally deploy new agent will work, if it's not working, then it more likely to be the service problem. So just try to restart the "Visual studio Team Foundation backgroud job Agent" service (try this several times).

    If that still not work, just try to change another vailable account for the Agent service. Then try it again.

    enter image description here