cgroup memory limit problems
Hi,
I have a machine with 6GB of ram and a cgroup for apache processes limited to
memory.limit_in_bytes = "5100M";
memory.soft_limit_in_bytes = "5000M";Unfortunately when apache processes ate all ram assigned to their cgroup load on whole machine jumps the roof.
cgroup aware OOM kicks in, kills one process and that doesn't help.
If I'm fast enough I notice and then apache processes require tons of kill -9 (I'm doing "killall -9 apache" in a while (true) loop for 20-30s) to get killed (and that not always succeeds - sometimes I'm unable to kill these and I'm just doing sysrq u, s, b after few minutes.. if I'm lucky. Sometimes I cannot do any command).
This all happens on 2.6.38.8 kernel.
http://ixion.pld-linux.org/~arekm/cgroup-eaten-memory-failure-1.txt
for kernel log. It ends with reboot of the machine.
Now the question is - is this is how cgroup memory limit supposed to work? If yes then it's hardly usable but maybe there are some patches for this?
Would newer kernels be better ? (cannot test immediately since newer kernels kill ipmi connectivity on that machine). I would expect apache processes to be killed without taking down entire machine.
ps. found similar history at http://serverfault.com/questions/211509/how-to-
stop-apache-from-crashing-my-entire-server from year ago
Signature · 6 lines
Arkadiusz Miśkiewicz PLD/Linux Team arekm / maven.pl http://ftp.pld-linux.org/ _______________________________________________ Containers mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Arkadiusz Miśkiewicz
Hi,
I have a machine with 6GB of ram and a cgroup for apache processes limited to
memory.limit_in_bytes = "5100M"; memory.soft_limit_in_bytes = "5000M";Unfortunately when apache processes ate all ram assigned to their cgroup load on whole machine jumps the roof.
cgroup aware OOM kicks in, kills one process and that doesn't help.
Did you try to disable the oom with the "memory.oom_control" file by setting it to "1" ?
If the cgroup runs out of memory they should be stopped until you give more memory or kill some tasks.
Hope that helps
-- Daniel
_______________________________________________
Containers mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Arkadiusz Miśkiewicz
Hi,
I have a machine with 6GB of ram and a cgroup for apache processes limited to
memory.limit_in_bytes = "5100M"; memory.soft_limit_in_bytes = "5000M";
Quoted 7 lines
Quoted 4 lines
Unfortunately when apache processes ate all ram assigned to their cgroup load on whole machine jumps the roof.
cgroup aware OOM kicks in, kills one process and that doesn't help.
Did you try to disable the oom with the "memory.oom_control" file by setting it to "1" ?
No, will try.
Quoted 3 lines
If the cgroup runs out of memory they should be stopped until you give more memory or kill some tasks.
I hope these tasks will be allowed to be killed when oom will be disabled. Right now it's often impossible to kill these.
Anyway I would preffer httpd processed to be automaticly killed without manual intervention.
Quoted 2 lines
Hope that helps
-- Daniel
Signature · 6 lines
Arkadiusz Miśkiewicz PLD/Linux Team arekm / maven.pl http://ftp.pld-linux.org/ _______________________________________________ Containers mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/containers
2011/11/10 Arkadiusz Miśkiewicz <[email protected]>:
Quoted 7 lines
Hi,
I have a machine with 6GB of ram and a cgroup for apache processes limited to memory.limit_in_bytes = "5100M"; memory.soft_limit_in_bytes = "5000M";
Can you please send the output of memory.stat?
Quoted 11 lines
Unfortunately when apache processes ate all ram assigned to their cgroup load on whole machine jumps the roof.
cgroup aware OOM kicks in, kills one process and that doesn't help.
If I'm fast enough I notice and then apache processes require tons of kill -9 (I'm doing "killall -9 apache" in a while (true) loop for 20-30s) to get killed (and that not always succeeds - sometimes I'm unable to kill these and I'm just doing sysrq u, s, b after few minutes.. if I'm lucky. Sometimes I cannot do any command).
Quoted 4 lines
This all happens on 2.6.38.8 kernel.
http://ixion.pld-linux.org/~arekm/cgroup-eaten-memory-failure-1.txt
for kernel log. It ends with reboot of the machine.
From the logs
"Nov 9 20:48:53 tm2 kernel: [18300.349106] Task in /somecgroup/httpd killed as a result of limit of /somecgroup/httpd
Nov 9 20:48:53 tm2 kernel: [18300.349110] memory: usage 5222400kB, limit 5222400kB, failcnt 282869 Nov 9 20:48:53 tm2 kernel: [18300.349113] memory+swap: usage 0kB,
limit 9007199254740991kB, failcnt 0"
It seems like you've disabled swap, is that correct?
Balbir
_______________________________________________
Containers mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): CAKTCnzmHk1U6fP+jrw2Rq3dLwU30gyocRBp2QpQVHAbU=x5uSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
CC'ing cgroups list
Balbir
2011/11/10 Balbir Singh <[email protected]>:
Quoted 36 lines
2011/11/10 Arkadiusz Miśkiewicz <[email protected]>:
Quoted 7 lines
Hi,
I have a machine with 6GB of ram and a cgroup for apache processes limited to memory.limit_in_bytes = "5100M"; memory.soft_limit_in_bytes = "5000M";
Can you please send the output of memory.stat?
Quoted 11 lines
Unfortunately when apache processes ate all ram assigned to their cgroup load on whole machine jumps the roof.
cgroup aware OOM kicks in, kills one process and that doesn't help.
If I'm fast enough I notice and then apache processes require tons of kill -9 (I'm doing "killall -9 apache" in a while (true) loop for 20-30s) to get killed (and that not always succeeds - sometimes I'm unable to kill these and I'm just doing sysrq u, s, b after few minutes.. if I'm lucky. Sometimes I cannot do any command).
Quoted 4 lines
This all happens on 2.6.38.8 kernel.
http://ixion.pld-linux.org/~arekm/cgroup-eaten-memory-failure-1.txt
for kernel log. It ends with reboot of the machine.From the logs
"Nov 9 20:48:53 tm2 kernel: [18300.349106] Task in /somecgroup/httpd killed as a result of limit of /somecgroup/httpd
Nov 9 20:48:53 tm2 kernel: [18300.349110] memory: usage 5222400kB, limit 5222400kB, failcnt 282869
Nov 9 20:48:53 tm2 kernel: [18300.349113] memory+swap: usage 0kB, limit 9007199254740991kB, failcnt 0"
Quoted 4 lines
It seems like you've disabled swap, is that correct?
Balbir
_______________________________________________
Containers mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/containers
Quoted 8 lines · Balbir Singh
2011/11/10 Arkadiusz Miśkiewicz <[email protected]>:
Quoted 5 lines
Hi,
I have a machine with 6GB of ram and a cgroup for apache processes
limited to memory.limit_in_bytes = "5100M"; memory.soft_limit_in_bytes = "5000M";Can you please send the output of memory.stat?
Right now there is small number of users using this server (night here) so:
# cat /dev/cgroup/memory/somecgroup/httpd/memory.stat cache 511426560 rss 2637795328 mapped_file 2129920 pgpgin 32233755 pgpgout 31509870 inactive_anon 720896 active_anon 2637271040 inactive_file 255959040 active_file 255234048 unevictable 0 hierarchical_memory_limit 5347737600 total_cache 511426560 total_rss 2637795328 total_mapped_file 2129920 total_pgpgin 32233755 total_pgpgout 31509870 total_inactive_anon 720896 total_active_anon 2637271040 total_inactive_file 255959040 total_active_file 255234048 total_unevictable 0
Quoted 18 lines
Quoted 12 lines
Unfortunately when apache processes ate all ram assigned to their cgroup load on whole machine jumps the roof.
cgroup aware OOM kicks in, kills one process and that doesn't help.
If I'm fast enough I notice and then apache processes require tons of kill -9 (I'm doing "killall -9 apache" in a while (true) loop for 20-30s) to get killed (and that not always succeeds - sometimes I'm unable to kill these and I'm just doing sysrq u, s, b after few minutes.. if I'm lucky. Sometimes I cannot do any command).
Quoted 3 lines
This all happens on 2.6.38.8 kernel.
http://ixion.pld-linux.org/~arekm/cgroup-eaten-memory-failure-1.txt
for kernel log. It ends with reboot of the machine.From the logs
Quoted 8 lines
"Nov 9 20:48:53 tm2 kernel: [18300.349106] Task in /somecgroup/httpd killed as a result of limit of /somecgroup/httpd
Nov 9 20:48:53 tm2 kernel: [18300.349110] memory: usage 5222400kB, limit 5222400kB, failcnt 282869 Nov 9 20:48:53 tm2 kernel: [18300.349113] memory+swap: usage 0kB,limit 9007199254740991kB, failcnt 0"
It seems like you've disabled swap, is that correct?
Yes, this machine has no swap but the kernel has
# zcat /proc/config.gz |grep CGROUP_MEM CONFIG_CGROUP_MEM_RES_CTLR=y CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y # CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED is not set
+ ctlr swap wasn't enabled at boot.
Quoted 1 line
Balbir
ps. vger.kernel.org doesn't like my address (no idea why and postmaster@ is silent), so likely my reply won't reach cgroup@
Signature · 6 lines
Arkadiusz Miśkiewicz PLD/Linux Team arekm / maven.pl http://ftp.pld-linux.org/ _______________________________________________ Containers mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 69 lines · On Wed, 9 Nov 2011 23:58:57 +0100 Arkadiusz Miśkiewicz <[email protected]> wrote:
Quoted 8 lines · Balbir Singh
2011/11/10 Arkadiusz Miśkiewicz <[email protected]>:
Quoted 5 lines
Hi,
I have a machine with 6GB of ram and a cgroup for apache processes
limited to memory.limit_in_bytes = "5100M"; memory.soft_limit_in_bytes = "5000M";Can you please send the output of memory.stat?
Right now there is small number of users using this server (night here) so:
# cat /dev/cgroup/memory/somecgroup/httpd/memory.stat cache 511426560 rss 2637795328 mapped_file 2129920 pgpgin 32233755 pgpgout 31509870 inactive_anon 720896 active_anon 2637271040 inactive_file 255959040 active_file 255234048 unevictable 0 hierarchical_memory_limit 5347737600 total_cache 511426560 total_rss 2637795328 total_mapped_file 2129920 total_pgpgin 32233755 total_pgpgout 31509870 total_inactive_anon 720896 total_active_anon 2637271040 total_inactive_file 255959040 total_active_file 255234048 total_unevictable 0Quoted 18 lines
Quoted 12 lines
Unfortunately when apache processes ate all ram assigned to their cgroup load on whole machine jumps the roof.
cgroup aware OOM kicks in, kills one process and that doesn't help.
If I'm fast enough I notice and then apache processes require tons of kill -9 (I'm doing "killall -9 apache" in a while (true) loop for 20-30s) to get killed (and that not always succeeds - sometimes I'm unable to kill these and I'm just doing sysrq u, s, b after few minutes.. if I'm lucky. Sometimes I cannot do any command).
Quoted 3 lines
This all happens on 2.6.38.8 kernel.
http://ixion.pld-linux.org/~arekm/cgroup-eaten-memory-failure-1.txt
for kernel log. It ends with reboot of the machine.From the logs
Quoted 8 lines
"Nov 9 20:48:53 tm2 kernel: [18300.349106] Task in /somecgroup/httpd killed as a result of limit of /somecgroup/httpd
Nov 9 20:48:53 tm2 kernel: [18300.349110] memory: usage 5222400kB, limit 5222400kB, failcnt 282869 Nov 9 20:48:53 tm2 kernel: [18300.349113] memory+swap: usage 0kB,limit 9007199254740991kB, failcnt 0"
It seems like you've disabled swap, is that correct?
Yes, this machine has no swap but the kernel has
# zcat /proc/config.gz |grep CGROUP_MEM CONFIG_CGROUP_MEM_RES_CTLR=y CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y # CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED is not set
Quoted 6 lines
+ ctlr swap wasn't enabled at boot.
Quoted 1 line
Balbir
ps. vger.kernel.org doesn't like my address (no idea why and postmaster@ is silent), so likely my reply won't reach cgroup@
If you can, please try the latest kernels.
recent 2 commits
commit 79dfdaccd1d5b40ff7cf4a35a0e63696ebb78b4d
" memcg: make oom_lock 0 and 1 based rather than counter " commit 1d65f86db14806cf7b1218c7b4ecb8b4db5af27d
" mm: preallocate page before lock_page() at filemap COW"
are works well against fork-bomb under memcg. In my test, make -j under swapless memcg hangs (or takes long time) to be oom-killed.
Thanks,
-Kame
_______________________________________________
Containers mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): 20111110091012.0ce7d719.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org
Sorry to reply late
Quoted 1 line · KAMEZAWA Hiroyuki
On Wed, 9 Nov 2011 23:58:57 +0100
[...]
Quoted 6 lines
If you can, please try the latest kernels.
recent 2 commits
commit
79dfdaccd1d5b40ff7cf4a35a0e63696ebb78b4d
" memcg: makeoom_lock0 and 1 based rather than counter "
This one needs a follow up fix (23751be0094012eb6b4756fa80ca54b3eb83069f "memcg: fix hierarchical oom locking")
Quoted 5 lines
commit
1d65f86db14806cf7b1218c7b4ecb8b4db5af27d
" mm: preallocate page beforelock_page()at filemap COW"are works well against fork-bomb under memcg. In my test, make -j under swapless memcg hangs (or takes long time) to be oom-killed.
Signature · 10 lines
Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Sorry to reply late
Quoted 1 line · KAMEZAWA Hiroyuki
On Wed, 9 Nov 2011 23:58:57 +0100
[...]
Quoted 6 lines
If you can, please try the latest kernels.
recent 2 commits
commit
79dfdaccd1d5b40ff7cf4a35a0e63696ebb78b4d
" memcg: makeoom_lock0 and 1 based rather than counter "
This one needs a follow up fix (23751be0094012eb6b4756fa80ca54b3eb83069f "memcg: fix hierarchical oom locking")
Quoted 5 lines
commit
1d65f86db14806cf7b1218c7b4ecb8b4db5af27d
" mm: preallocate page beforelock_page()at filemap COW"are works well against fork-bomb under memcg. In my test, make -j under swapless memcg hangs (or takes long time) to be oom-killed.
Signature · 6 lines
Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic