{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/18087","labels_url":"https://api.github.com/repos/docker/docker/issues/18087/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/18087/comments","events_url":"https://api.github.com/repos/docker/docker/issues/18087/events","html_url":"https://github.com/docker/docker/issues/18087","id":117788877,"number":18087,"title":"Invalid memory limit in container cgroup file","user":{"login":"nacx","id":446705,"avatar_url":"https://avatars.githubusercontent.com/u/446705?v=3","gravatar_id":"","url":"https://api.github.com/users/nacx","html_url":"https://github.com/nacx","followers_url":"https://api.github.com/users/nacx/followers","following_url":"https://api.github.com/users/nacx/following{/other_user}","gists_url":"https://api.github.com/users/nacx/gists{/gist_id}","starred_url":"https://api.github.com/users/nacx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nacx/subscriptions","organizations_url":"https://api.github.com/users/nacx/orgs","repos_url":"https://api.github.com/users/nacx/repos","events_url":"https://api.github.com/users/nacx/events{/privacy}","received_events_url":"https://api.github.com/users/nacx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-19T10:54:27Z","updated_at":"2015-11-19T14:21:21Z","closed_at":null,"body":"**Description of problem:**\r\nWhen running containers without memory limits, the memory cgroup file that stores the memory limit has an invalid value. See the following steps to reproduce for details:\r\n\r\n```bash\r\n$ docker run -d redis\r\n08bd1b1ef7667906112e5bafe6fe8125ee6fd983ce2f411aa5e55d215db03835\r\n$ docker inspect -f '{{.HostConfig.Memory}}' 08bd1b1ef766\r\n0  # This is expected\r\n```\r\n\r\nThe redis container has no memory constraints, so it should be able to use all host memory. However, the memory cgroup for the container shows an invalid value, far bigger than the actual total memory in the host.\r\n\r\n```bash\r\n$ grep Mem /proc/meminfo \r\nMemTotal:        4035420 kB   # Total host memory. Expected to match the cgroup limit\r\nMemFree:          297544 kB\r\n$ cat /sys/fs/cgroup/memory/docker/08bd1b1ef7667906112e5bafe6fe8125ee6fd983ce2f411aa5e55d215db03835/memory.limit_in_bytes \r\n18446744073709551615   # This is 17179869183 GB memory, which is obviously wrong\r\n```\r\n\r\nWhen running containers with memory constraints, the memory limit cgroup file has the right value.\r\n\r\n**docker version**:\r\nClient:\r\n Version:      1.9.0\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   76d6bc9\r\n Built:        Tue Nov  3 17:43:42 UTC 2015\r\n OS/Arch:      linux/amd64\r\n\r\nServer:\r\n Version:      1.9.0\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   76d6bc9\r\n Built:        Tue Nov  3 17:43:42 UTC 2015\r\n OS/Arch:      linux/amd64\r\n\r\n**docker info**:\r\nContainers: 3\r\nImages: 65\r\nServer Version: 1.9.0\r\nStorage Driver: aufs\r\n Root Dir: /var/lib/docker/aufs\r\n Backing Filesystem: extfs\r\n Dirs: 71\r\n Dirperm1 Supported: false\r\nExecution Driver: native-0.2\r\nLogging Driver: json-file\r\nKernel Version: 3.13.0-67-generic\r\nOperating System: Ubuntu 14.04.3 LTS\r\nCPUs: 8\r\nTotal Memory: 3.848 GiB\r\nName: thunder04\r\nID: IXHS:LGA5:GUVS:3MFH:7FQ3:CKCL:GB5C:6JGU:YKDO:YOCN:B6KI:2MLX\r\nWARNING: No swap limit support\r\n\r\n**uname -a**:\r\nLinux thunder04 3.13.0-67-generic #110-Ubuntu SMP Fri Oct 23 13:24:41 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux\r\n\r\n**Environment details (AWS, VirtualBox, physical, etc.)**:\r\nPhysical host. Detailed hardware information available [here](https://gist.github.com/nacx/8977840af3adbd008680)."},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/158071262","html_url":"https://github.com/docker/docker/issues/18087#issuecomment-158071262","issue_url":"https://api.github.com/repos/docker/docker/issues/18087","id":158071262,"user":{"login":"phemmer","id":1826947,"avatar_url":"https://avatars.githubusercontent.com/u/1826947?v=3","gravatar_id":"","url":"https://api.github.com/users/phemmer","html_url":"https://github.com/phemmer","followers_url":"https://api.github.com/users/phemmer/followers","following_url":"https://api.github.com/users/phemmer/following{/other_user}","gists_url":"https://api.github.com/users/phemmer/gists{/gist_id}","starred_url":"https://api.github.com/users/phemmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phemmer/subscriptions","organizations_url":"https://api.github.com/users/phemmer/orgs","repos_url":"https://api.github.com/users/phemmer/repos","events_url":"https://api.github.com/users/phemmer/events{/privacy}","received_events_url":"https://api.github.com/users/phemmer/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T14:21:21Z","updated_at":"2015-11-19T14:21:21Z","body":"> it is not consistent with what the documentation says.\r\n\r\nWhat documentation are you referring to?\r\n\r\n> Tracing the memory limits and consumption for a container using the stats api would report inconsistent values when compared to the values obtained using the \"/info\" endpoint to get the host limits \r\n\r\nI don't follow. Neither the stats api, nor `/info` have any relation to (and do not display) the cgroup `memory.limit_in_bytes` parameter. So why is `memory.limit_in_bytes` being set to the max an issue?"}}