Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why client lost in Redis server? #26

Closed
coanor opened this issue Aug 2, 2013 · 1 comment
Closed

Why client lost in Redis server? #26

coanor opened this issue Aug 2, 2013 · 1 comment

Comments

@coanor
Copy link

coanor commented Aug 2, 2013

I use redis_connect(ip, port) to connect the Redis server(long time connection), then it works well, but about 10 minutes later,the connection is closed(active or passive, I don't know)

false : lua_scripts/lib/redis.lua:264: connection error: closed

And all the successive command are failed. I have browsed the out put of CLIENT LIST, and not list my client's IP, why this happened?

@nrk
Copy link
Owner

nrk commented Aug 5, 2013

Hi @coanor,

First of all you should make sure that the timeout value is set to 0 on your Redis server (see redis.conf) or it will drop any client idling for more than the specified value (not-so-old versions of Redis had a default timeout of 300 seconds AFAIR, now the default is 0).

On the client end you must create the connection by setting the timeout parameter to 0 like in the following snippet to prevent the socket from being closed for a timeout when there's no activity:

local redis = require 'redis'
local client = redis.connect({ host = '127.0.0.1', timeout = 0 })

@nrk nrk closed this as completed Dec 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants