PECL/memcached segfaults
[email protected] (Brian Moon) Thu, 06 May 2010 01:09:00 -0500
| Newsgroups | php.pecl.dev |
|---|---|
| Message-ID | <[email protected]> |
I was finally able to reproduce the cause on my dev server. The
segfaults were caused by the process exceeding its open file limit. This
explains why only one data center had segfaults (the busier one) and the
other only saw increasing connections to memcached.
On a dev server, running the worker MPM and mod_php, I configured the
server with:
StartServers 2
MinSpareThreads 20
MaxSpareThreads 20
ThreadsPerChild 10
MaxClients 20
MaxRequestsPerChild 0
This creates 2 Apache processes, each with 10 threads for a total of 20
children.
I am using persistent connections when creating the memcached connections.
The memcached connection count grows and grows and grows until the
process hits 1024 open files and is killed by the kernel.
I did write the persistent string being sent to the object constructor
out to the php error log to ensure we were not sending a unique string
each time. We are not. At most there should be two connections per
child/process (not sure how the persistence is handled for threads).
pecl/memcache creates them per child (thread).
I turned off the persistence and things work as they should. The
connection count does not grow.
So, next I turned off worker thinking this was a threading issue. But,
the problem persisted.
In the end, I was able to reproduce the issue with a simple script. Here
is the script and output: http://pastebin.com/40vzVM7D There is a run
with pecl/memcache there as well to show the difference in behavior.
Tested platforms:
Gentoo Linux
PHP/5.2.13
libmemcached/0.38 thru 0.40
pecl-memcached/1.0.0 thru 1.0.2
Mac - Darwin Kernel Version 10.3.0
PHP 5.3.1
libmemcached/0.40
pecl-memcached/1.0.2
--
Brian.
--------
http://brian.moonspot.net/