Could not transition to inspecting; timed out after waiting 30s
So issue 278 had a problem after 10 seconds: https://github.com/aws/amazon-ecs-agent/issues/278 but we are getting it after 30 seconds, running: docker 1.9.1 ecs agent 1.7.1 amzn-ami-2015.09.e-amazon-ecs-optimized (ami-cb2305a1)
I'd give docker info output as well, but docker command hangs if asked to do anything besides "docker help".
The docker log file last entry was about an 30 minutes before problem is noticed - but not DEBUG enabled. Tried sending USR1 signal but didn't cause any noticeable change.
Job load consists of burst of about 100 Python/Django jobs every 30 minutes - the runs take 1-20 minutes to finish, and we space out the actual run commands so as not to exceed the throttling. Get through several cycles before having problems but yet to make it through 24 hours (48 cycles) before one of our 4 t2.large instances gets locked up.
On the dead box see output like:
[ec2-user@ip-172-30-1-94 ~]$ ps auxw | grep python root 399 1.1 0.0 0 0 ? Ds 23:00 0:37 [python] root 1200 0.2 0.8 210684 68336 ? Ds 23:01 0:07 python ./manage.py new_collect_ads -u 913302022066397 ec2-user 4691 0.0 0.0 110460 2132 pts/0 S+ 23:55 0:00 grep --color=auto python root 32205 0.7 0.0 0 0 ? Ds 23:00 0:25 [python] root 32303 1.3 0.0 0 0 ? Ds 23:00 0:45 [python] root 32415 0.2 0.0 0 0 ? Ds 23:00 0:09 [python] root 32531 0.6 0.0 0 0 ? Ds 23:00 0:20 [python]
where the "[python]" lines are not killable though when there is only 1 or 2 of them a "docker ps" will sometimes eventually produce an answer.
How to track down what is going wrong?
Was having same issue, Only recreating instance helped. Did u run anything outside of ecs tasks?
Ran "docker run --log-driver=fluentd hello-world" by hand on the instances to confirm I had fluentd logging set up properly, also poked around with ps, greped logs etc but nothing else docker related, and nothing "heavy" or long lived.
Can you check if the docker storage volume has run out of disk space? We recently updated the ECS Optimized AMI documentation on how to get this information. If you do find that docker has run out of disk space on the new volume, you could try increasing the storage as described in the "To extend the Docker logical volume" section of the document.
That looks like it might be the problem. 2 of the 4 instances are 100% full. The other 2 are less than 45% full.
peter@bastion01:~$ dsh -cMg macc sudo vgs [email protected]: VG #PV #LV #SN Attr VSize VFree [email protected]: docker 1 1 0 wz--n- 22.00g 68.00m [email protected]: VG #PV #LV #SN Attr VSize VFree [email protected]: docker 1 1 0 wz--n- 22.00g 60.00m [email protected]: VG #PV #LV #SN Attr VSize VFree [email protected]: docker 1 1 0 wz--n- 22.00g 76.00m [email protected]: VG #PV #LV #SN Attr VSize VFree [email protected]: docker 1 1 0 wz--n- 22.00g 76.00m peter@bastion01:~$ dsh -cMg macc sudo lvs [email protected]: LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert [email protected]: docker-pool docker twi-aot--- 21.88g 41.19 62.93 [email protected]: LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert [email protected]: docker-pool docker twi-aot--- 21.88g 44.39 55.12 [email protected]: LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert [email protected]: docker-pool docker twi-aot-M- 21.88g 100.00 86.02 [email protected]: LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert [email protected]: docker-pool docker twi-aot-M- 21.88g 100.00 85.60 peter@bastion01:~$
How to purge this space? What is stored in there? I'm always running the same image over and over (slightly different args) and don't need to keep historical run information (at least not for very long.)
The volume is used by the docker storage setup to store metadata information about containers (including container logs). It can build up over time depending on the frequency of container starts and stops. By default, the ECS agent cleans up stopped containers older than 3 hours. We have a fix in our dev branch to make this duration configurable. You can try cleaning up older containers manually as well (docker rm). But, if all the docker commands are hanging, you can extend the volume as per my earlier description, which should unblock you for the time being.
If you do find that docker has run out of disk space on the new volume, you could try increasing the storage as described in the "To extend the Docker logical volume" section of the document
Thanks @aaithal this has made things start to work!
Looking forward to the configurable setting. ;-)
Will do hourly on each instance:
docker ps -a -q \| xargs docker rm -f
for now.
Glad that this helped you resolve the issue. Thank you for reporting this issue. Please let us know if you need more help. Closing this for now.
Seems my hourly purge may be causing troubles @aaithal . I ended up without the "-f" flag to "docker rm", figured that would be "safer"?
This morning looking at the AWS console showed some 48 tasks running and all of them started back about two days ago (they typically run for less than 20 minutes, some maybe 30 minutes). A "docker ps" on the instances showed only the ecs agent running... none of the tasks the console showed - despite refreshing screen, logout, back in etc. i.e. seemed console (and aws cli) were out of sync with actual instances. (top and ps on instances showed no tasks running either.)
We released a new version of the agent that supports a new environment variable config ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION that allows you to set this variable. Could you please update to the new agent version (instructions here) to help with faster clean-ups?
@aaithal Thank you for the new control variable.
Ran the "Update Agent" button on 3 of my 4 instances.
The instances are all less than a week old and were running version 1.7.1.
On the "Cluster" page I saw the "Agent Connected" switch to false, then back to true, but they kept reporting being at version 1.7.1?
Tried a second time on just one instance and it seemed to get stuck in the "false" (Disconnected?) state for several minutes.
Ran by hand on each instance:
sudo stop ecs ; sleep 10 ; sudo start ecs
which un-stuck things and seems two of them then registered that they had upgraded to version 1.8.0.
Repeated attempts seemed to finally get all boxes upgraded and running with an /etc/ecs/ecs.config containing:
ECS_CLUSTER=macc
ECS_AVAILABLE_LOGGING_DRIVERS=["json-file","syslog","fluentd"]
ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION=30m
Slightly more painful than would be nice, but maybe just needed more details on how slow the process could be so my expectations would be more in line with the experience. ;-)
Thanks again.
@workybee We released a new AMI (2015.09.g) with ecs-agent v1.8.1, and I see from #316 you are already using it. Does this resolve the issue described here?
@juanrhenals - yes, the latest AMI (2015.09.g) and ecs-agent v1.8.1 seem to have fixed the various issues we were having with starting about 100 new python based tasks every 15 minutes on our cluster of 4 m4.large instances.
@workybee Great to hear. I'm going to close out this issue now. Let us know if you have any further issues.
Thanks!