JetBrains / teamcity-docker-agent

TeamCity agent docker image sources
https://hub.docker.com/r/jetbrains/teamcity-agent/
Apache License 2.0
77 stars 64 forks source link

Windows TeamCity images don't seem to stop correctly #37

Open wtigotw opened 6 years ago

wtigotw commented 6 years ago

Using: TeamCity Server 2018.1.1 running on Windows 10 Enterprise 1803 Using: Docker Cloud plugin to launch agents Docker image: jetbrains/teamcity-agent:2018.1.1-nanoserver-sac2016

When a build agent is commanded to shut down by TC, either because of manual request ("Stop" clicked from Agents->Cloud screen) or automatic shutdown via plugin configuration ("Terminate after first build" setting), the container is immediately shut down successfully, but TeamCity reports "Cloud image is not configured to stop agents gracefully. The agent that was not stopped gracefully might be assigned with the build."

I have set a shutdown timeout of two minutes on the container but that does not help. From everything I can tell, the container is gracefully shutting down but I believe the agent process within is not.

dtretyakov commented 6 years ago

@wtigotw, did you tried to stop the same container on this machine via regular docker run ... / docker stop ... / docker rm ... commands? Does it stop build agents gracefully?

Note: since Docker Cloud plugin is 3rd party plugin we don't know how it terminates the docker container.

wtigotw commented 5 years ago

Ah, good point. Yes, I failed to recognize the shutdown mechanism of the plugin could should be considered.

Using docker run ... / docker stop ... / docker rm ..., I see the following in the TC logs:

[2018-08-28 15:41:03,285]   WARN -    jetbrains.buildServer.AGENT - Agent "ip_xx.xx.xx.xx" {id=158} is unauthorized on registration
[2018-08-28 15:45:23,322]   INFO -    jetbrains.buildServer.AGENT - Agent can't be pinged, last communication time: 2018-08-28 15:44:22.457, agent: "ip_xx.xx.xx.xx" {id=158, protocol=unidirectional, host=xx.xx.xx.xx:9090, agentTypeId=11, pool=Default, registered since 2018-08-28 15:41:03.175}
[2018-08-28 15:45:23,322]   INFO - ldServer.AGENT.PollingProtocol - Polling Agent session 'LRkyHfm...' was closed, agent: "ip_xx.xx.xx.xx" {id=158}
[2018-08-28 15:45:23,328]   INFO -    jetbrains.buildServer.AGENT - Agent "ip_xx.xx.xx.xx" {id=158} has been unregistered. Reason: Cannot access agent