Segmentation fault after redis server Closing idle client #237

songerzhou opened this Issue Aug 29, 2012 · 3 comments


None yet

3 participants


redis server config timeout=60

here is the php code
ini_set('memory_limit', -1);
ini_set('default_socket_timeout', 3600);

$conn = new Redis();
$conn->pconnect('localhost', 6379);

$conn->set("foo", "bar");
echo $conn->get("foo");
echo "\n";


echo $conn->get("foo");
echo "\n";


#0 _php_stream_set_option (stream=0x253e8e0, option=12, value=0, ptrparam=0x0) at /data/src/php-5.2.17/main/streams/streams.c:1165
#1 0x0000000000674166 in _php_stream_xport_create (name=0x2513858 "localhost:6379", namelen=14, options=4, flags=2,
persistent_id=0x25137b0 "phpredis:localhost:6379:0.000000", timeout=0x7fffcbf99fd0, context=0x0, error_string=0x7fffcbf9a070, error_code=0x7fffcbf9a08c)
at /data/src/php-5.2.17/main/streams/transports.c:79
#2 0x00007fc7e1d87f6c in redis_sock_connect (redis_sock=0x2513e88) at /data/src/nicolasff-phpredis-22f4555/library.c:888
#3 0x00007fc7e1d87999 in redis_check_eof (redis_sock=0x2513e88) at /data/src/nicolasff-phpredis-22f4555/library.c:59
#4 0x00007fc7e1d87d5f in redis_sock_write (redis_sock=0x2513e88, cmd=0x2513900 "*2\r\n$7\r\nHGETALL\r\n$3\r\nxxx\r\n", sz=26)
at /data/src/nicolasff-phpredis-22f4555/library.c:1218
#5 0x00007fc7e1d6e097 in generic_hash_command_1 (ht=, return_value=0x2513588, return_value_ptr=, this_ptr=,
return_value_used=, keyword=0x7fc7e1d97604 "HGETALL", keyword_len=7) at /data/src/nicolasff-phpredis-22f4555/redis.c:4582
#6 0x00007fc7e1d81224 in zim_Redis_hGetAll (ht=1, return_value=0x2513588, return_value_ptr=0x0, this_ptr=0x2511fe0, return_value_used=1)
at /data/src/nicolasff-phpredis-22f4555/redis.c:4632
#7 0x00007fc7e2834377 in xdebug_execute_internal (current_execute_data=0x7fffcbf9a770, return_value_used=1) at /tmp/pear/temp/xdebug/xdebug.c:1483
#8 0x00000000006cd7d3 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffcbf9a770) at /data/src/php-5.2.17/Zend/zend_vm_execute.h:202
#9 0x00000000006ba23c in execute (op_array=0x2512808) at /data/src/php-5.2.17/Zend/zend_vm_execute.h:92
#10 0x00007fc7e2834859 in xdebug_execute (op_array=0x2512808) at /tmp/pear/temp/xdebug/xdebug.c:1391
#11 0x0000000000697a7a in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /data/src/php-5.2.17/Zend/zend.c:1134
#12 0x0000000000656cfb in php_execute_script (primary_file=0x7fffcbf9ce30) at /data/src/php-5.2.17/main/main.c:2036
#13 0x0000000000709223 in main (argc=2, argv=0x7fffcbf9d028) at /data/src/php-5.2.17/sapi/cli/php_cli.c:1165


I can't reproduce this issue with the latest master. @songerzhou, is this still an issue for you?


I seem to have a similar issue though I couldn't figure out if it is related to timeouts so far.
Also it seems to appear random, 2-3 times per day.
Since then I've lowered the timeout considerably for testing and that made the issue occur much more often.
This is with latest master (from May 06, 2013).

Here's a backtrace from a coredump that occurs:

Program terminated with signal 11, Segmentation fault.
#0 0x00000001004c2b98 in _php_stream_set_option ()
(gdb) bt
#0 0x00000001004c2b98 in _php_stream_set_option ()
#1 0x00000001004c15c4 in _php_stream_eof ()
#2 0xffffffff78544f24 in redis_check_eof () from ...php/extensions/no-debug-non-zts-20100525/
#3 0xffffffff7854d1d0 in redis_sock_write () from .../php/extensions/no-debug-non-zts-20100525/
#4 0xffffffff7850e15c in redis_generic_setex () from .../php/extensions/no-debug-non-zts-20100525/
#5 0xffffffff7850e6b4 in zim_Redis_setex () from .../php/extensions/no-debug-non-zts-20100525/
#6 0x00000001005b7ec0 in zend_do_fcall_common_helper_SPEC ()
#7 0x00000001005b8e90 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER ()
#8 0x00000001005b64b8 in execute ()
#9 0x0000000100566d94 in zend_execute_scripts ()
#10 0x000000010049e998 in php_execute_script ()
#11 0x00000001006deb50 in main ()


Note: This seems to happen with persistent connections only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment