php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58866 Segfaults with 3.0.4 after unexpect restart of memcached
Submitted: 2009-09-24 04:24 UTC Modified: 2013-02-18 00:35 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: harry+pecl at local dot ch Assigned: hradtke (profile)
Status: No Feedback Package: memcache (PECL)
PHP Version: 5.2.10 OS: CentOS release 5.3
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-09-24 04:24 UTC] harry+pecl at local dot ch
Description:
------------
After upgrade from memcache 3.0.1 to 3.0.4 we noticed that restarting memcached daemons can cause clients to segfault.

We haven't been able to narrow it down so far so can only give you general info.

Traffic wise we're doing doing between 5 and 10 cache requests per second under normal traffic.

On the client side we're only doing sets and gets.

memcached version is 1.2.8 ( from danga ).

PHP version 5.2.11 as Apache module.

Each memcached client will have between 10-15 memcached daemons that it may connect to via http://www.php.net/memcache-addserver using persistent connections.

Otherwise it's intermittent - restarting a memcached doesn't _always_ result in client segfaults but there is a high likelihood in the live environment ( have been unable to reproduce in dev environment ).


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-23 13:08 UTC] jason at pirkplace dot com
Experienced the same issue:

CentOS 5.4
PHP 5.2.10
Memcache Client 3.0.4
Memcached 1.2.8

Apache module as well.
 [2010-03-28 09:43 UTC] pierre dot php at gmail dot com
Can you try using trunk or the NON_BLOCKING_IO branch please? I can't reproduce it using any of them.
 [2010-05-14 07:03 UTC] ufaweb at gmail dot com
We experience the same problem - spawn-fcgi workers die with 
SIGSEGV with pecl-memcache 3.0.4 when one of two memcached 
servers is down. With 3.0.1 no SIGSEGVs.

p.s. PHP 5.3.2, FreeBSD 8.0-STABLE i386
 [2010-06-14 13:24 UTC] djohansson at vemglobal dot com
I think I am also experiencing a variation of this issue. Particularly with the session save handler.

PHP will generate the warning: "Failed to write session data (memcache). Please verify that the current setting of session.save_path is correct"

Usually the apache log will have a child process segfault around the same time. 

In the session save path, I have 4 servers listed, with the most weight given to the localhost.

The errors occur randomly, and for the most part only affects a single request in a given period. I have started to see an increase in errors of late, from a couple per week to several per day.
 [2011-01-07 18:19 UTC] pada at hrz dot tu-chemnitz dot de
I can reproduce SegFault with two unreachable Servers with 
multi get:

Command line:

php -r '$m = new Memcache(); $m->addServer("s1"); $m-
>addServer("s2"); $m->get(array("k1","k2"));'

Output:

PHP Warning:  MemcachePool::get(): php_network_getaddresses: 
getaddrinfo failed: Name or service not known in Command 
line code on line 1
PHP Notice:  MemcachePool::get(): Server s2 (tcp 11211, udp 
0) failed with: php_network_getaddresses: getaddrinfo 
failed: Name or service not known (0) in Command line code 
on line 1
PHP Warning:  MemcachePool::get(): php_network_getaddresses: 
getaddrinfo failed: Name or service not known in Command 
line code on line 1
PHP Notice:  MemcachePool::get(): Server s1 (tcp 11211, udp 
0) failed with: php_network_getaddresses: getaddrinfo 
failed: Name or service not known (0) in Command line code 
on line 1
Speicherzugriffsfehler


$ php -r '$m = new Memcache(); $m->addServer("s1"); $m-
>addServer("s2"); $m->get(array("k1","k2"));'
PHP Warning:  MemcachePool::get(): php_network_getaddresses: 
getaddrinfo failed: Name or service not known in Command 
line code on line 1
PHP Notice:  MemcachePool::get(): Server s2 (tcp 11211, udp 
0) failed with: php_network_getaddresses: getaddrinfo 
failed: Name or service not known (0) in Command line code 
on line 1
PHP Warning:  MemcachePool::get(): php_network_getaddresses: 
getaddrinfo failed: Name or service not known in Command 
line code on line 1
PHP Notice:  MemcachePool::get(): Server s1 (tcp 11211, udp 
0) failed with: php_network_getaddresses: getaddrinfo 
failed: Name or service not known (0) in Command line code 
on line 1
Speicherzugriffsfehler
$ php --version
PHP 5.3.3-6 with Suhosin-Patch (cli) (built: Dec  7 2010 
12:47:03) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend 
Technologies
$ dpkg -l php5* |grep ^ii
ii  php5-cli                                     5.3.3-6                                
command-line interpreter for the php5 scripting language
ii  php5-common                                  5.3.3-6                                
Common files for packages built from the php5 source
ii  php5-ldap                                    5.3.3-6                                
LDAP module for php5
ii  php5-memcache                                3.0.4-4                                
memcache extension module for PHP5
 [2011-03-04 10:44 UTC] flo at freebsd dot org
I can also reproduce this.

OS: FreeBSD 8.2 and 9-CURRENT
Webserver: nginx 0.8.54
Php: 5.3.5 (running as fpm)
pecl-memcache: 3.0.5

I have 2 memcache servers in session.save_path, as soon as one goes down, the fpm worker processes die:

Mar 04 16:30:30.374057 [WARNING] [pool www] child 18530 exited on signal 10 (SIGBUS) after 35.872334 seconds from start
Mar 04 16:30:30.374375 [NOTICE] [pool www] child 18569 started
Mar 04 16:30:30.416024 [WARNING] [pool www] child 18531 exited on signal 10 (SIGBUS) after 35.913949 seconds from start
Mar 04 16:30:30.416387 [NOTICE] [pool www] child 18570 started
Mar 04 16:30:30.462851 [WARNING] [pool www] child 18532 exited on signal 10 (SIGBUS) after 35.960400 seconds from start
Mar 04 16:30:30.463158 [NOTICE] [pool www] child 18571 started

Versions 3.0.1 to 3.0.3 work, 3.0.4 and 3.0.5 don't work.
 [2011-03-14 01:31 UTC] hradtke@php.net
Using Pada's script I can confirm this is broken in 3.0.4 and 3.0.5.  However, I do not see this breakin trunk.  Please verify this works in trunk.
 [2011-03-22 06:37 UTC] flo at freebsd dot org
Yes, you are right with trunk it does indeed work.
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 07:01:31 2024 UTC