Agent reboot not working on Win x64 (related to TW-9538)
Hi,
This post is related to my discussion in TW-9538 (http://youtrack.jetbrains.net/issue/TW-9538)
Tested on: MS Windows Server 2003 Standard x64 Edition
I've added to the Agent.properties file:
teamcity.agent.reboot.command=shutdown -r -t 60 -c "TeamCity Agent reboot command" -f
The Agent log shows:
WARN - erver.agent.AgentRemoteApiImpl - Failed to start Reboot command.CreateProcess: shutdown -r -t 60 -c "TeamCity Agent reboot command" -f error=2
Our dev did some investigations a while back, and found that invoking 64 bit windows processes from a 32 bit java VM was the culprit. So, to solve the issue we made a workaround, of which I'm not very fond. What we did is implement our own shutdown ANT script. This one is run from a 64 bit Java installation on the 64 bit boxes (so ANT runs on a 64 bit VM).
That fixed the problem, so in effect we follow this chain to do a shutdown:
Agent -> ANT Script in Agent VM (32 bit) -> Invoke ANT Script on different 64 Bit VM -> Shutdown.exe
At the time I've accepted the workaround, but it kept nagging me. While discussing TW-9538 (http://youtrack.jetbrains.net/issue/TW-9538) it all came back to haunt us (we can not use the TC Agent Reboot functionality, which is needed for that issue). So, this time I invested some googling time to see what I could come up with.
First I stumbeled upon:
http://www.eggheadcafe.com/software/aspnet/31891452/heads-up-shutdownexe-on-windows-64.aspx
Good, there are more having the issue.
After that I found this great article:
http://bit.ly/gc8pSS
The information in there, I think, hits the right explanation.
Our workaround works because we can invoke a 64 bit ANT from a 32 bit one, and the 64 bit ANT _is_ able to invoke the 64 bit Reboot.exe.
I've tried to hardcode the path in the Agent properties file (teamcity.agent.reboot.command=C\:\\Windows\\System32\\shutdown.exe -r -t 60 -c "TeamCity Agent reboot command" -f), but that didn't work either :(
The workarounds suggested in the article all include having to do activities on the (agent) server. While this would be possible, I beleive a 64 TC Agent version would also not encounter the issue. The latter would make it work for us all, not having to configure\hotfix our Agent boxes.
Yours Sincerely,
Bob
Please sign in to leave a comment.
Bob,
Thank you for the helpful links.
Not sure what we can do so far... May be provide a way to automatically install a tool to reboot the machine...