php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59275 High CPU usage when apache runs out of file handles
Submitted: 2010-06-21 05:14 UTC Modified: -
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: andy dot rigby at cybertill dot co dot uk Assigned:
Status: Open Package: memcache (PECL)
PHP Version: 5.2.11 OS: RHEL5
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-06-21 05:14 UTC] andy dot rigby at cybertill dot co dot uk
Description:
------------
Runing version 3.0.4 beta
Using memcache session save handler. Prefork apache.

We had an instance where after adding additional virtual host entries (with inidividual log files) after an apache restart CPU hit 100% for each running apache process. 

After running gdb, found a backtrace was always stuck in mmc_pool_select() or mmc_pool_run(). I can't quite remember which - unfortunately I did not save the backtrace and currently failing to reproduce in our dev. environment. I found this blog that has the exact same symptoms: http://blog.roaldseth.net/2009/08/debugging-peclmemcache.html which provides analysis of problem area.

Although this is ultimately a configuration problem (lack of file handles), it would be good if memcache could catch this and not use 100% cpu, which brings down the server.



Reproduce code:
---------------
Unable to reproduce at the moment, though I suspect ulimit -n for the apache process + combination of memcache seession handler will do it.

-- memcache.ini --
extension=memcache.so
memcache.protocol=ascii
session.save_handler=memcache
session.save_path="tcp://XXXX:11211?persistent=1&weight=1&timeout=1&retry_interval=15,tcp://XXXX:11211?persistent=1&
weight=1&timeout=1&retry_interval=15,tcp://XXXX:11211?persistent=1&weight=1&timeout=1&retry_interval=15,tcp://XXXX:1
1211?persistent=1&weight=1&timeout=1&retry_interval=15"


<?php

session_start();

Expected result:
----------------
An error about memcache not being able to obtain a file handle, not high cpu.

Actual result:
--------------
100% cpu for each httpd process doing a session_start()

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 15 19:01:25 2019 UTC