You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docker process was using almost all of my memory (4 gig total)
$ top
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
838 root 20 0 6698.0m 3.185g 1.7m S 0.3 82.5 10:34.55 docker
It sorted itself out (killing all my containers in the process), but not before bringing the entire system down to its knees.
Any hints on how to debug/prevent this in the future?
Docker Info
# docker version
Client version: 1.2.0
Client API version: 1.14
Go version (client): go1.3.1
Git commit (client): fa7b24f
OS/Arch (client): linux/amd64
Server version: 1.2.0
Server API version: 1.14
Go version (server): go1.3.1
Git commit (server): fa7b24f
@cnf What was running on the Docker daemon? Was it running some containers which were printing a lot to stdout or stderr? Did you run a very large number of containers? Did you push/pull a lot of images?
@cnf Did you run docker logs on those containers a bunch of times? The only way this would happen is through the logging.
The memory you've seen wasn't memory allocated and still used by Docker itself. It was memory which was used at one point and wasn't released back to the OS by the Go runtime.
I suspect this is indeed caused by logging because you have a log which is 105 MB on disk and you don't seem to have done much else which could have caused this (like pulling/pushing images, building a lot and so on). Logging has been a known problem for a while, including writing a lot to stdout, stderr, using docker logs).
Docker 1.3 won't have this problem any more for logging, pushing and pulling. I think those were the last areas of the code where there were some problems in 1.2 regarding memory allocations.
I'm using docker 1.3.2 and I still have problems with the docker daemon using large amounts of memory (was having the same problems on 1.2). I'm running a cluster of 3 boxes which have the same containers running on all of them. The environments are identical, same aws instance types, same OS image. And whenever we run deploys we run the exact same commands on all them, thus resulting in the same number of docker pulls, same containers running, same number of images on each, etc.
But, no matter what after some time at least one of the boxes docker daemon's will start using a large amount of memory (4+ GB), while the others will stay normal (100-200MB). The fact that the environments are very similar and yet the problem only manifests itself sporadically leads me to think whatever causes the high memory usage has some randomness to it, not directly correlated to # of images/containers/logs/pulls/etc. Currently we end up just rebooting the box when this occurs since we run a HA setup across the 3 boxes, but this is obviously less than ideal. Below is a graph of usable memory, showing the leaking docker daemon box.
@efuquen Thanks! Then this is probably because of high amount of logs between daemon and client. We'll try to reduce memory usage of that code path. We have some ideas already.
@LK4D4 Great to hear. Just to be clear, when you say 'logs between daemon and client' do you mean output that would show up in docker logs or some other logging going on? Are there any recommendations to mitigate the issue in the mean time? Finally, should I keep track of this ticket for any status updates or any PR that would be opened to help address it?
@efuquen I'm saying that when you do docker run without -d you get all output from container through unix socket from daemon to client. You can try to reduce logging output of your applications or use syslog for them through /dev/log. I know this is bullshit, but now I can't imagine other fixes for high-output applications :(
Sorry guys but I didn't get the point!
My problem is that I have several pods running on K8S cluster and over there I can see that all pods are using something like 4 GB of RAM and there is "dockerd" daemon is using 7 GB of RAM.
Is this normal?
@darkprisco this issue was created over three years ago, which means the code that was running at the time likely has been completely rewritten (or not even in this repository anymore).
If you think there's a bug, and have information to reproduce/investigate, it's best to open a new issue with the information that's requested in the issue template.
Activity
cnf commentedon Oct 10, 2014
On closer inspection, it seems to have restarted itself, which would explain why all my containers where killed.
Same question still stands, though.
unclejack commentedon Oct 10, 2014
@cnf What was running on the Docker daemon? Was it running some containers which were printing a lot to stdout or stderr? Did you run a very large number of containers? Did you push/pull a lot of images?
cnf commentedon Oct 10, 2014
@unclejack as docker info shows, Containers: 14, Images: 202. 9 of those are running, and 5 data containers.
There is some, logging, but not a lot:
unclejack commentedon Oct 10, 2014
@cnf Did you run
docker logson those containers a bunch of times? The only way this would happen is through the logging.The memory you've seen wasn't memory allocated and still used by Docker itself. It was memory which was used at one point and wasn't released back to the OS by the Go runtime.
I suspect this is indeed caused by logging because you have a log which is 105 MB on disk and you don't seem to have done much else which could have caused this (like pulling/pushing images, building a lot and so on). Logging has been a known problem for a while, including writing a lot to stdout, stderr, using
docker logs).Docker 1.3 won't have this problem any more for logging, pushing and pulling. I think those were the last areas of the code where there were some problems in 1.2 regarding memory allocations.
cnf commentedon Oct 10, 2014
I can't replicate it with running
docker logson the one with 105M worth of logs... and even those where accrued over a few weeks, nothing sudden.paultag commentedon Jan 6, 2015
I see this on my machines too. Both aufs and overlayfs.
From top, sorted by memory:
The problem is much worse with aufs. Overlayfs delays this and only has the daemon going into high memory usage.
efuquen commentedon Jan 12, 2015
I'm using docker 1.3.2 and I still have problems with the docker daemon using large amounts of memory (was having the same problems on 1.2). I'm running a cluster of 3 boxes which have the same containers running on all of them. The environments are identical, same aws instance types, same OS image. And whenever we run deploys we run the exact same commands on all them, thus resulting in the same number of docker pulls, same containers running, same number of images on each, etc.
But, no matter what after some time at least one of the boxes docker daemon's will start using a large amount of memory (4+ GB), while the others will stay normal (100-200MB). The fact that the environments are very similar and yet the problem only manifests itself sporadically leads me to think whatever causes the high memory usage has some randomness to it, not directly correlated to # of images/containers/logs/pulls/etc. Currently we end up just rebooting the box when this occurs since we run a HA setup across the 3 boxes, but this is obviously less than ideal. Below is a graph of usable memory, showing the leaking docker daemon box.
LK4D4 commentedon Jan 12, 2015
@efuquen Thanks for report. Just for note: how do you run your containers? With some init system in foreground?
efuquen commentedon Jan 12, 2015
@LK4D4 they're running as systemd services.
LK4D4 commentedon Jan 12, 2015
@efuquen Thanks! Then this is probably because of high amount of logs between daemon and client. We'll try to reduce memory usage of that code path. We have some ideas already.
efuquen commentedon Jan 12, 2015
@LK4D4 Great to hear. Just to be clear, when you say 'logs between daemon and client' do you mean output that would show up in
docker logsor some other logging going on? Are there any recommendations to mitigate the issue in the mean time? Finally, should I keep track of this ticket for any status updates or any PR that would be opened to help address it?LK4D4 commentedon Jan 12, 2015
@efuquen I'm saying that when you do
docker runwithout -d you get all output from container through unix socket from daemon to client. You can try to reduce logging output of your applications or use syslog for them through/dev/log. I know this is bullshit, but now I can't imagine other fixes for high-output applications :(jbiel commentedon Jan 24, 2015
+1. This one is affecting us.
unclejack commentedon Jan 26, 2015
This problem is the exact same one as #9139.
#10347 should help fix this problem for long running containers.
jessfraz commentedon Feb 26, 2015
closing as dup of #9139
priscofarina commentedon Oct 26, 2017
Sorry guys but I didn't get the point!
My problem is that I have several pods running on K8S cluster and over there I can see that all pods are using something like 4 GB of RAM and there is "dockerd" daemon is using 7 GB of RAM.
Is this normal?
thaJeztah commentedon Oct 26, 2017
@darkprisco this issue was created over three years ago, which means the code that was running at the time likely has been completely rewritten (or not even in this repository anymore).
If you think there's a bug, and have information to reproduce/investigate, it's best to open a new issue with the information that's requested in the issue template.