container still exist after stop job
I run a job, and then stop it. when the job stopped, I checked the resource, found that the container still exist.

log of framework launcher:
2018-08-22 07:32:57,239 INFO [pool-1-thread-1] com.microsoft.frameworklauncher.service.StatusManager: [oneflow_runner_multi_test][10]: stopFramework
2018-08-22 07:32:57,239 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service: org.apache.hadoop.yarn.client.api.impl.YarnClientImpl entered state INITED
2018-08-22 07:32:57,239 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service: org.apache.hadoop.yarn.client.api.impl.AHSClientImpl entered state INITED
2018-08-22 07:32:57,239 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service: org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl entered state INITED
2018-08-22 07:32:57,241 DEBUG [pool-1-thread-1] org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory: The property 'ssl.client.truststore.location' has not been set, no TrustStore will be loaded
2018-08-22 07:32:57,274 INFO [pool-1-thread-1] org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl: Timeline service address: http://10.11.3.5:8188/ws/v1/timeline/
2018-08-22 07:32:57,274 INFO [pool-1-thread-1] org.apache.hadoop.yarn.client.RMProxy: Connecting to ResourceManager at /10.11.3.5:8032
2018-08-22 07:32:57,274 DEBUG [pool-1-thread-1] org.apache.hadoop.security.UserGroupInformation: PrivilegedAction as:root (auth:SIMPLE) from:org.apache.hadoop.yarn.client.RMProxy.getProxy(RMProxy.java:136)
2018-08-22 07:32:57,274 DEBUG [pool-1-thread-1] org.apache.hadoop.yarn.ipc.YarnRPC: Creating YarnRPC for org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC
2018-08-22 07:32:57,275 DEBUG [pool-1-thread-1] org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC: Creating a HadoopYarnProtoRpc proxy for protocol interface org.apache.hadoop.yarn.api.ApplicationClientProtocol
2018-08-22 07:32:57,275 INFO [pool-1-thread-1] org.apache.hadoop.yarn.client.AHSProxy: Connecting to Application History server at /10.11.3.5:10200
2018-08-22 07:32:57,275 DEBUG [pool-1-thread-1] org.apache.hadoop.security.UserGroupInformation: PrivilegedAction as:root (auth:SIMPLE) from:org.apache.hadoop.yarn.client.AHSProxy.getProxy(AHSProxy.java:49)
2018-08-22 07:32:57,275 DEBUG [pool-1-thread-1] org.apache.hadoop.yarn.ipc.YarnRPC: Creating YarnRPC for org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC
2018-08-22 07:32:57,275 DEBUG [pool-1-thread-1] org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC: Creating a HadoopYarnProtoRpc proxy for protocol interface org.apache.hadoop.yarn.api.ApplicationHistoryProtocol
2018-08-22 07:32:57,275 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service org.apache.hadoop.yarn.client.api.impl.AHSClientImpl is started
2018-08-22 07:32:57,275 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl is started
2018-08-22 07:32:57,275 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service org.apache.hadoop.yarn.client.api.impl.YarnClientImpl is started
2018-08-22 07:32:57,275 INFO [pool-1-thread-1] com.microsoft.frameworklauncher.common.utils.HadoopUtils: [yarn application -kill application_1531732078765_0387]
2018-08-22 07:32:57,479 INFO [pool-1-thread-1] org.apache.hadoop.yarn.client.api.impl.YarnClientImpl: Killed application application_1531732078765_0387
2018-08-22 07:32:57,479 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service: org.apache.hadoop.yarn.client.api.impl.YarnClientImpl entered state STOPPED
2018-08-22 07:32:57,479 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service: org.apache.hadoop.yarn.client.api.impl.AHSClientImpl entered state STOPPED
2018-08-22 07:32:57,479 DEBUG [pool-1-thread-1] org.apache.hadoop.service.AbstractService: Service: org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl entered state STOPPED
2018-08-22 07:32:57,479 INFO [pool-1-thread-1] com.microsoft.frameworklauncher.service.StatusManager: Transitioned Framework [oneflow_runner_multi_test] from [APPLICATION_RUNNING] to [APPLICATION_RETRIEVING_DIAGNOSTICS] with SkipToPersist = [true]
2018-08-22 07:32:57,479 INFO [pool-1-thread-1] com.microsoft.frameworklauncher.service.StatusManager: Transitioned Framework [oneflow_runner_multi_test] from [APPLICATION_RETRIEVING_DIAGNOSTICS] to [APPLICATION_COMPLETED] with SkipToPersist = [true]
2018-08-22 07:32:57,481 INFO [pool-1-thread-1] com.microsoft.frameworklauncher.service.StatusManager: Transitioned Framework [oneflow_runner_multi_test] from [APPLICATION_COMPLETED] to [FRAMEWORK_COMPLETED] with SkipToPersist = [false]
log of node manager:
18/08/22 07:32:58 WARN nodemanager.DefaultContainerExecutor: Exit code from container container_e02_1531732078765_0387_01_000003 is : 137
18/08/22 07:32:58 INFO container.ContainerImpl: Container container_e02_1531732078765_0387_01_000003 transitioned from KILLING to CONTAINER_CLEANEDUP_AFTER_KILL
18/08/22 07:32:58 INFO nodemanager.NMAuditLogger: USER=_0a52807bf7ed4a1aaca63fa4b3a29acb OPERATION=Container Finished - Killed TARGET=ContainerImpl RESULT=SUCCESS APPID=application_1531732078765_0387 CONTAINERID=container_e02_1531732078765_0387_01_000003
18/08/22 07:32:58 INFO container.ContainerImpl: Container container_e02_1531732078765_0387_01_000003 transitioned from CONTAINER_CLEANEDUP_AFTER_KILL to DONE
18/08/22 07:32:58 INFO application.ApplicationImpl: Removing container_e02_1531732078765_0387_01_000003 from application application_1531732078765_0387
18/08/22 07:32:58 INFO application.ApplicationImpl: Application application_1531732078765_0387 transitioned from FINISHING_CONTAINERS_WAIT to APPLICATION_RESOURCES_CLEANINGUP
18/08/22 07:32:58 INFO logaggregation.AppLogAggregatorImpl: Considering container container_e02_1531732078765_0387_01_000003 for log-aggregation
18/08/22 07:32:58 INFO containermanager.AuxServices: Got event CONTAINER_STOP for appId application_1531732078765_0387
18/08/22 07:32:58 INFO containermanager.AuxServices: Got event APPLICATION_STOP for appId application_1531732078765_0387
18/08/22 07:32:58 INFO application.ApplicationImpl: Application application_1531732078765_0387 transitioned from APPLICATION_RESOURCES_CLEANINGUP to FINISHED
18/08/22 07:32:58 INFO logaggregation.AppLogAggregatorImpl: Application just finished : application_1531732078765_0387
18/08/22 07:32:58 INFO logaggregation.AppLogAggregatorImpl: Uploading logs for container container_e02_1531732078765_0387_01_000003. Current good log dirs are /var/lib/yarn/userlogs
18/08/22 07:33:01 INFO monitor.ContainersMonitorImpl: Stopping resource-monitoring for container_e02_1531732078765_0387_01_000003
Can you check the application status in yarn.
Additionally, job container will keep a few minutes after you stop the job. Do you run docker ps immediately at stop the job in webportal?
Hi, thanks for your reply.
This container has exist for several days after stopped. And I execute yarn application -list |grep application_1531732078765_0387 to check the application status, and it return nothing.
yarn application -list returns:
root@XP011:/# yarn application -list
18/08/28 02:21:41 INFO impl.TimelineClientImpl: Timeline service address: http://10.11.3.5:8188/ws/v1/timeline/
18/08/28 02:21:41 INFO client.RMProxy: Connecting to ResourceManager at /10.11.3.5:8032
18/08/28 02:21:42 INFO client.AHSProxy: Connecting to Application History server at /10.11.3.5:10200
Total number of applications (application-types: [] and states: [SUBMITTED, ACCEPTED, RUNNING]):13
Application-Id Application-Name Application-Type User Queue State Final-State Progress Tracking-URL
application_1531732078765_0492 [oneflow_runner_multi_test_9]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _0a52807bf7ed4a1aaca63fa4b3a29acb default RUNNING UNDEFINED 0% N/A
application_1531732078765_0485 [08272]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _0c2e44362a9c4ddb903788fed08fc3e4 default RUNNING UNDEFINED 0% N/A
application_1531732078765_0483 [wyong_3]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _868ff49ad22e4dc19c5a56d7c71cbfaf default RUNNING UNDEFINED 0% N/A
application_1531732078765_0400 [wangchen-019]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _3a53e8f1a5104cedacc285436e788ae9 default RUNNING UNDEFINED 0% N/A
application_1531732078765_0371 [platform_test_cpu_2]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _b94a2b9ec435415f88ccd14dc57d20ac default RUNNING UNDEFINED 0% N/A
application_1531732078765_0376 [wangchen-018]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _3a53e8f1a5104cedacc285436e788ae9 default RUNNING UNDEFINED 0% N/A
application_1531732078765_0369 [platform_test_cpu]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _b94a2b9ec435415f88ccd14dc57d20ac default RUNNING UNDEFINED 0% N/A
application_1531732078765_0474 [zhangquan-fan12]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _11e04c095162455f80dac2b3219e18b0 default RUNNING UNDEFINED 0% N/A
application_1531732078765_0472 [test-gpu]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _e2eb9236063744fe84bba63f89f56fad default RUNNING UNDEFINED 0% N/A
application_1531732078765_0473 [platform_3gpu_B]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _b94a2b9ec435415f88ccd14dc57d20ac default RUNNING UNDEFINED 0% N/A
application_1531732078765_0272 [transfer_1]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _bace8e5b43c9435289f43197ab88c799 default RUNNING UNDEFINED 0% N/A
application_1531732078765_0291 [wangchen-017]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _3a53e8f1a5104cedacc285436e788ae9 default RUNNING UNDEFINED 0% N/A
application_1531732078765_0295 [test-gpu-04]_[10]_[UNKNOWN]_[172.17.0.4]_[UNKNOWN] LAUNCHER _e2eb9236063744fe84bba63f89f56fad default RUNNING UNDEFINED 0% N/A
yarn application -list |grep application_1531732078765_0387 returns:
root@XP011:/# yarn application -list |grep application_1531732078765_0387
18/08/28 02:22:22 INFO impl.TimelineClientImpl: Timeline service address: http://10.11.3.5:8188/ws/v1/timeline/
18/08/28 02:22:22 INFO client.RMProxy: Connecting to ResourceManager at /10.11.3.5:8032
18/08/28 02:22:22 INFO client.AHSProxy: Connecting to Application History server at /10.11.3.5:10200
I think it means this application is deleted, but the container stays.
I checked docker log by command journalctl -u docker.service. When I filter by container id 2e6c1bdff1dc, I find this:
Aug 22 15:22:02 XP011 dockerd[2106]: time="2018-08-22T15:22:02+08:00" level=info msg="shim docker-containerd-shim started" address="/containerd-shim/moby/2e6c1bdff1dc5e20fd57ba433a8fb4708a7ce65822a4885fe5
Aug 22 15:22:05 XP011 dockerd[2106]: time="2018-08-22T15:22:05.048809112+08:00" level=error msg="attach: stdout: write unix /var/run/docker.sock->@: write: broken pipe"
Aug 22 15:22:05 XP011 dockerd[2106]: time="2018-08-22T15:22:05.199400257+08:00" level=error msg="attach failed with error: write unix /var/run/docker.sock->@: write: broken pipe"
Aug 22 15:22:05 XP011 dockerd[2106]: time="2018-08-22T15:22:05+08:00" level=info msg="shim reaped" id=2a4299f9ef9f721ee425c00e54a02b62132fdad7db88b2a06dc69711d1843ea0 module="containerd/tasks"
Aug 22 15:22:05 XP011 dockerd[2106]: time="2018-08-22T15:22:05.238779194+08:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Aug 22 15:33:03 XP011 dockerd[2106]: time="2018-08-22T15:33:03.218464380+08:00" level=error msg="attach: stdout: write unix /var/run/docker.sock->@: write: broken pipe"
Which version of PAI are you running? Do you know if it is Yarn container or Docker container exists? Can you share us the container log? (including Docker container and Yarn container).
We have designed a lease to prevent from Zombie containers, which usually works well. https://github.com/Microsoft/pai/blob/master/rest-server/src/templates/dockerContainerScript.mustache#L39
One exception is when system enters unstable state, e.g., the application uses too much memory that causing system halt. Other issues including Docker bugs, etc. Usually you will be able to find out the root cause through Yarn/Docker logs.
I update the code at May 17th as I remember.
Yarn container log is more than 3GB, and I filter it by container id container_e02_1531732078765_0387_01_000003:
.log:6328955:18/08/22 07:21:56 INFO containermanager.ContainerManagerImpl: Start request for container_e02_1531732078765_0387_01_000003 by user _0a52807bf7ed4a1aaca63fa4b3a29acb
t.log:6328958:18/08/22 07:21:56 INFO nodemanager.NMAuditLogger: USER=_0a52807bf7ed4a1aaca63fa4b3a29acb IP=10.11.2.45 OPERATION=Start Container Request TARGET=ContainerManageImpl RESULT=SUCCESS APPID=application_1531732078765_0387 CONTAINERID=container_e02_1531732078765_0387_01_000003
t.log:6328960:18/08/22 07:21:56 INFO application.ApplicationImpl: Adding container_e02_1531732078765_0387_01_000003 to application application_1531732078765_0387
t.log:6328962:18/08/22 07:21:56 INFO container.ContainerImpl: Container container_e02_1531732078765_0387_01_000003 transitioned from NEW to LOCALIZING
t.log:6328966:18/08/22 07:21:56 INFO localizer.ResourceLocalizationService: Created localizer for container_e02_1531732078765_0387_01_000003
t.log:6328967:18/08/22 07:21:56 INFO localizer.ResourceLocalizationService: Writing credentials to the nmPrivate file /var/lib/hadoopdata/nm-local-dir/nmPrivate/container_e02_1531732078765_0387_01_000003.tokens. Credentials list:
t.log:6328969:18/08/22 07:21:56 INFO nodemanager.DefaultContainerExecutor: Copying from /var/lib/hadoopdata/nm-local-dir/nmPrivate/container_e02_1531732078765_0387_01_000003.tokens to /var/lib/hadoopdata/nm-local-dir/usercache/_0a52807bf7ed4a1aaca63fa4b3a29acb/appcache/application_1531732078765_0387/container_e02_1531732078765_0387_01_000003.tokens
t.log:6328973:18/08/22 07:21:56 INFO container.ContainerImpl: Container container_e02_1531732078765_0387_01_000003 transitioned from LOCALIZING to LOCALIZED
t.log:6328974:18/08/22 07:21:56 INFO container.ContainerImpl: Container container_e02_1531732078765_0387_01_000003 transitioned from LOCALIZED to RUNNING
t.log:6328975:18/08/22 07:21:56 INFO nodemanager.DefaultContainerExecutor: launchContainer: [bash, /var/lib/hadoopdata/nm-local-dir/usercache/_0a52807bf7ed4a1aaca63fa4b3a29acb/appcache/application_1531732078765_0387/container_e02_1531732078765_0387_01_000003/default_container_executor.sh]
t.log:6328976:18/08/22 07:21:59 INFO monitor.ContainersMonitorImpl: Starting resource-monitoring for container_e02_1531732078765_0387_01_000003
t.log:6329004:18/08/22 07:21:59 INFO monitor.ContainersMonitorImpl: Memory usage of ProcessTree 106348 for container-id container_e02_1531732078765_0387_01_000003: 196.3 MB of 17 GB physical memory used; 2.7 GB of 35.7 GB virtual memory used
t.log:6329039:18/08/22 07:22:02 INFO monitor.ContainersMonitorImpl: Memory usage of ProcessTree 106348 for container-id container_e02_1531732078765_0387_01_000003: 22.1 MB of 17 GB physical memory used; 64.6 MB of 35.7 GB virtual memory used
……(lots of resource monitoring)
t.log:6336284:18/08/22 07:32:42 INFO monitor.ContainersMonitorImpl: Memory usage of ProcessTree 106348 for container-id container_e02_1531732078765_0387_01_000003: 21.6 MB of 17 GB physical memory used; 64.6 MB of 35.7 GB virtual memory used
t.log:6336319:18/08/22 07:32:45 INFO monitor.ContainersMonitorImpl: Memory usage of ProcessTree 106348 for container-id container_e02_1531732078765_0387_01_000003: 21.6 MB of 17 GB physical memory used; 64.6 MB of 35.7 GB virtual memory used
t.log:6336354:18/08/22 07:32:48 INFO monitor.ContainersMonitorImpl: Memory usage of ProcessTree 106348 for container-id container_e02_1531732078765_0387_01_000003: 21.6 MB of 17 GB physical memory used; 64.6 MB of 35.7 GB virtual memory used
t.log:6336389:18/08/22 07:32:52 INFO monitor.ContainersMonitorImpl: Memory usage of ProcessTree 106348 for container-id container_e02_1531732078765_0387_01_000003: 21.6 MB of 17 GB physical memory used; 64.6 MB of 35.7 GB virtual memory used
t.log:6336424:18/08/22 07:32:55 INFO monitor.ContainersMonitorImpl: Memory usage of ProcessTree 106348 for container-id container_e02_1531732078765_0387_01_000003: 21.6 MB of 17 GB physical memory used; 64.6 MB of 35.7 GB virtual memory used
t.log:6336446:18/08/22 07:32:58 INFO container.ContainerImpl: Container container_e02_1531732078765_0387_01_000003 transitioned from RUNNING to KILLING
t.log:6336447:18/08/22 07:32:58 INFO launcher.ContainerLaunch: Cleaning up container container_e02_1531732078765_0387_01_000003
t.log:6336462:18/08/22 07:32:58 INFO monitor.ContainersMonitorImpl: Memory usage of ProcessTree 106348 for container-id container_e02_1531732078765_0387_01_000003: 2.9 MB of 17 GB physical memory used; 18.0 MB of 35.7 GB virtual memory used
t.log:6336470:18/08/22 07:32:58 WARN nodemanager.DefaultContainerExecutor: Exit code from container container_e02_1531732078765_0387_01_000003 is : 137
t.log:6336471:18/08/22 07:32:58 INFO container.ContainerImpl: Container container_e02_1531732078765_0387_01_000003 transitioned from KILLING to CONTAINER_CLEANEDUP_AFTER_KILL
t.log:6336472:18/08/22 07:32:58 INFO nodemanager.NMAuditLogger: USER=_0a52807bf7ed4a1aaca63fa4b3a29acb OPERATION=Container Finished - Killed TARGET=ContainerImpl RESULT=SUCCESS APPID=application_1531732078765_0387 CONTAINERID=container_e02_1531732078765_0387_01_000003
t.log:6336473:18/08/22 07:32:58 INFO container.ContainerImpl: Container container_e02_1531732078765_0387_01_000003 transitioned from CONTAINER_CLEANEDUP_AFTER_KILL to DONE
t.log:6336474:18/08/22 07:32:58 INFO application.ApplicationImpl: Removing container_e02_1531732078765_0387_01_000003 from application application_1531732078765_0387
t.log:6336476:18/08/22 07:32:58 INFO logaggregation.AppLogAggregatorImpl: Considering container container_e02_1531732078765_0387_01_000003 for log-aggregation
t.log:6336481:18/08/22 07:32:58 INFO logaggregation.AppLogAggregatorImpl: Uploading logs for container container_e02_1531732078765_0387_01_000003. Current good log dirs are /var/lib/yarn/userlogs
t.log:6336482:18/08/22 07:33:01 INFO monitor.ContainersMonitorImpl: Stopping resource-monitoring for container_e02_1531732078765_0387_01_000003
t.log:7523427:18/08/23 07:32:58 INFO nodemanager.DefaultContainerExecutor: Deleting absolute path : /var/lib/hadoopdata/nm-local-dir/usercache/_0a52807bf7ed4a1aaca63fa4b3a29acb/appcache/application_1531732078765_0387/container_e02_1531732078765_0387_01_000003
t.log:7523429:18/08/23 07:32:58 INFO nodemanager.DefaultContainerExecutor: Deleting path : /var/lib/yarn/userlogs/application_1531732078765_0387/container_e02_1531732078765_0387_01_000003/stdout
t.log:7523430:18/08/23 07:32:58 INFO nodemanager.DefaultContainerExecutor: Deleting path : /var/lib/yarn/userlogs/application_1531732078765_0387/container_e02_1531732078765_0387_01_000003/stderr
Docker container log:
creating /_0a52807bf7ed4a1aaca63fa4b3a29acb/oneflow_runner_multi_test/tmp/application_1531732078765_0387-0-0-10.11.1.11-
[INFO] Waiting for other containers ...
[INFO] Waiting for other containers ...
[INFO] Waiting for other containers ...
[INFO] Waiting for other containers ...
[INFO] Waiting for other containers ...
……(lots of waiting)
/pai_bootstrap.sh: line 92: 8 Killed while /bin/true; do
[ $(( $(date +%s) - $(stat -c %Y /alive/yarn_$PAI_CONTAINER_ID) )) -gt 60 ] && pkill -9 --ns 1; sleep 20;
done
/pai_bootstrap.sh: line 92: 514 Killed sleep 10
[INFO] Waiting for other containers ...
[INFO] Waiting for other containers ...
……(lots of waiting)
The lease you say is already in the version which we used.
It seems the Docker container didn't get killed despite "pkill -9"? I suggest you upgrade to our latest stable release to see if the problem still persistent (0.6.y). we should have fixed this issue long time ago.
@feng257 Could you help give more feedback whether this problem occurs again in latest code
close this issue, you can reopen if it appears again.