Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Redis leaks connections #6

Open
loki42 opened this Issue April 15, 2012 · 4 comments

3 participants

Loki Davison Didip Kerabat Svante Paldan
Loki Davison

Hi,
If i do not specify a connection pool, then connections are leaked continuously until you hit the max open files limit, at which point redis uses 100% of cpu and silently fails unless debug is set. The latest version of redis has fixed the silent nature of the failure.

testing with ab -n 1000 -c 10 the connection count climbs and doesn't fall until they time out.

netstat -tn|grep 6379|wc -l
6008
netstat -tn|grep 6379|wc -l
8009

if i specify a pool:

def setup_redis_session(app):
redis_pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
return SessionMiddleware(app, type="redis", url="localhost:6379", key="musicfilmcomedy", connection_pool=redis_pool)

after many requests:
netstat -tn|grep 6379|wc -l
10
netstat -tn|grep 6379|wc -l
13
netstat -tn|grep 6379|wc -l
8

I tested with uwsgi and cherrypy. I'm using the latest git code.

Didip Kerabat
Owner
didip commented April 15, 2012

@loki42 What is the version of your redis-py?

ConnectionPool should have been created by default during Redis.__init__. See: https://github.com/andymccurdy/redis-py/blob/master/redis/client.py#L191 (Which you mentioned)

The beaker_extension itself doesn't have separate redis-py requirement. It uses whatever you have.

Loki Davison

My py-redis is 2.4.5. And I just noticed in the py-redis changes file:

* Fixed a bug where some connections were not getting released back to the
  connection pool after pipeline execution.

I assume this is the bug i'm seeing. I'll upgrade py-redis and see if that fixes it.

Loki Davison

I've just run ab a few times, with cherrypy and uwsgi and using version 2.4.11 of py-redis and i'm getting the same thing.

netstat -tn|grep 6379|wc -l
4999

I run it with pool:
netstat -tn|grep 6379|wc -l
16

Svante Paldan
zwant commented March 01, 2013

I think that my pull request in #17 addresses this issue.

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.