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: 2021-03-25 16:29 UTC
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: cmb (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 5.2.11 OS: RHEL5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: andy dot rigby at cybertill dot co dot uk
New email:
PHP Version: OS:

 

 [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

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-25 16:29 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-25 16:29 UTC] cmb@php.net
The official bug tracker for PECL/memcache is now at
<https://github.com/websupport-sk/pecl-memcache/issues>.

So, if this is still an issue with either of the current memcache
versions (4 or 8), please file an issue there.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 10:01:31 2024 UTC