[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: segfault while simply get()ing a value from squeeze memcached

On Thursday 09 June 2011, Josip Rodin wrote:
> > select(3147, [1024 1223 1224 1227 1230 1231 1235 1241 1242 1243

> Hah, I found the apparent problem. The number of fds in those
> select() calls tipped me off to reexamine a change I recently did
> as part of the squeeze upgrade - I enabled a large number of
> virtual hosts which forced me to call 'ulimit -n 4096' in the
> apache2 init script.
> When I disabled >1500 virtual hosts and reduced their number to
> just 3, everything was just fine again.
> Please reassign the bug elsewhere if this is not actually specific
> to memcache.so - this is happening with:
> * libapache2-mod-php5 Version: 5.3.3-7+squeeze1
> * apache2-mpm-prefork Version: 2.2.16-6+squeeze1

I haven't looked at the code, but my guess is that php5-memcache uses 
the FD_SET macro and friends. This only works up to 1024 open fds. 
From select(2):

"An fd_set is a fixed size buffer.  Executing FD_CLR() or FD_SET() 
with a value of fd that is negative or is equal to or larger than 
FD_SETSIZE will result in undefined behavior. "

php5-memcache should probably use a different API (maybe poll()).

An alternative work-around would be to use php in fcgi mode.

Reply to: