5

some apache httpd process's memory and cpu usage too high, be killed by kernel, but I don't know why httpd use such many memory. I need some method to analyse or some method to reproduct.

some message about the apache and syslog

Server version: Apache/2.2.34 (Unix)
Server built:   Aug 17 2017 15:49:40

syslog message

Oct 19 15:28:20 kernel: httpd invoked oom-killer: gfp_mask=0x280da, order=0, oom_adj=0, oom_score_adj=0

Oct 19 15:28:20  kernel: httpd cpuset=/ mems_allowed=0-1

Oct 19 15:28:20  kernel: Pid: 7446, comm: httpd Not tainted 2.6.32_1-12-0-0 #1

Oct 19 15:28:20  kernel: Call Trace:

Oct 19 15:28:20  kernel:  [<ffffffff8108acf6>] ? dump_header+0x7c/0x187

Oct 19 15:28:20  kernel:  [<ffffffff8108b24b>] ? oom_kill_process+0x6c/0x17b

Oct 19 15:28:20  kernel:  [<ffffffff8108b784>] ? out_of_memory+0x32e/0x392

Oct 19 15:28:20  kernel:  [<ffffffff8108f6ce>] ? __alloc_pages_nodemask+0x694/0x7ff

Oct 19 15:28:20  kernel:  [<ffffffff810b60ac>] ? alloc_pages_vma+0x136/0x152

Oct 19 15:28:20  kernel:  [<ffffffff8109f281>] ? handle_pte_fault+0x16f/0x6f0

Oct 19 15:28:20  kernel:  [<ffffffff810033ee>] ? apic_timer_interrupt+0xe/0x20

Oct 19 15:28:20  kernel:  [<ffffffff813c5f70>] ? do_page_fault+0x444/0x46b

Oct 19 15:28:20  kernel:  [<ffffffff810a7984>] ? do_mremap+0x338/0x450

Oct 19 15:28:20  kernel:  [<ffffffff813c389f>] ? page_fault+0x1f/0x30

httpd ps img

Out of memory: Kill process 7446 (httpd) score 422 or sacrifice child

Killed process 7446, UID 500, (httpd) total-vm:922728068kB, anon-rss:28228104kB, file-rss:88kB
  • usually a memory leak or possibly an infinite loop allocating memory in a module like mod_php - which modules do you use? – Petr Chloupek Oct 19 at 10:07
  • 1
    That looks like Linux. 2.6.32? What distro version, RHEL 6 ? – John Mahowald Oct 21 at 18:32
4

This means is that a request to allocate X amount of memory failed. So the Kenrel invoked the OOM killer which will terminates the highest memory consuming applications. System is out of physical and/or swap memory. What can be used as temporary fix, is to increase your swap size, till getting more RAM modules or capacity added to your server.

Also you most likely have configured Apache with mpm_prefork as an Apache module. This setup is slow and not thread safe. Modern web server setups use Apache with mpm_event. This will give you better performance, without eating up all your memory.

  • No, the allocation request didn't fail. The only reason that OOM killing happens is that the allocation request succeeded due to overcommit, and then when the program actually needed the memory that it was allocated, the kernel didn't have it available. – Joseph Sible Oct 19 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.