Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Redis server went away #196

Closed
skey opened this Issue · 9 comments

5 participants

@skey

Env:
redis-server 2.4.1.4
phpredis 2.2.1
php 5.3.2-1
ubuntu 10.0.4

RedisException

Aways catch this exception, but can get data .


RedisException: Redis server went away in /var/www/redis.php on line 3

Call Stack:
0.0002 625328 1. {main}() /var/www/redis.php:0
0.4026 626376 2. Redis->pconnect(string(9), long) /var/www/redis.php:3

string(2) "OK"

Code

<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
var_dump($redis->ping());
$r=$redis->get('hello');
var_dump($r);
?>


and not install selinux

@michael-grunder

Hey,

In the call stack you are showing pconnect but the code is showing connect. Do you get the error either way? Also what is the value of default_socket_timeout in php.ini?

@skey

I try the

$redis->connect('127.0.0.1', 6379);

and

$redis->pconnect('127.0.0.1', 6379);

I upgrade the php to 5.3.10 and close the xdebug extension , the Issue is resolved。

@skey

default_socket_timeout = 60

@michael-grunder

I'm glad you got it working. Have you tried it with php 5.3.10 and xdebug enabled? I'm not sure how xdebug would affect this, but I'm not overly familiar with the xdebug internals.

@malletjo

The problem is coming from Xdebug.

malletjo@malletjo:/data/test$ php -v

PHP 5.3.10-1ubuntu3.1 with Suhosin-Patch (cli) (built: May 4 2012 02:20:36)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

malletjo@malletjo:/data/test$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

malletjo@malletjo:/data/test$ cat redis.php
<?php

$redis = new Redis();
$redis->connect('10.73.1.36', 6379);

if(!$redis->ping()) {
    die("NOT");
} else {
    die("YES");
}

?>

With Xdebug :

malletjo@malletjo:/data/test$ php -f redis.php
PHP RedisException: Redis server went away in /data/test/redis.php on line 4
PHP Stack trace:
PHP 1. {main}() /data/test/redis.php:0
PHP 2. Redis->connect() /data/test/redis.php:4

Wihout Xdebug:

malletjo@malletjo:/data/test$ php -f redis.php
YES

@damianb

you're a minor version behind on xdebug, 2.2.0 is out, give that a shot. probably will have to compile it; 2.1.0 has a bunch of killers anyways, like segfaulting on header_remove()

@damianb

oh, and a link to the repo: https://github.com/derickr/xdebug

@michael-grunder

I'm closing the issue as you've sorted it out, aside from the xdebug issue. I hope upgrading worked for you!

Thanks @damianb for the upgrade info. :)

@Esya

I confirm that this issue is still open.

PHP 5.3.3-7+squeeze15 with Suhosin-Patch (cli) (built: Mar  4 2013 13:11:17)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.3.0dev, Copyright (c) 2002-2013, by Derick Rethans

RedisException: Redis server went away

If I disable xdebug, I don't get the exception.

Workaround

At the moment I have to do this to get it working :

try {
    $redis->connect();
} catch (Exception $e) { }

Which is ugly. but makes it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.