#17943: Too many open file descriptors while using memcache
-------------------------+-------------------------------------------------
     Reporter:           |      Owner:  nobody
  m.gajda@…              |     Status:  new
         Type:  Bug      |    Version:  1.3
    Component:  Core     |   Keywords:  cache memcache open file
  (Cache system)         |  descriptors
     Severity:  Normal   |  Has patch:  1
 Triage Stage:           |      UI/UX:  0
  Unreviewed             |
Easy pickings:  0        |
-------------------------+-------------------------------------------------
 Hi all,

 I am using Django 1.3.1 with memcached server under Linux (PLD distro).
 Django application is run with runfcgi command (maxspare set to 20). After
 switching to Django 1.3.1 (from line 1.2.x) I encountered very strange
 behaviour -- the app became crashing after some time.

 What I have discovered is very large number of open socket connections
 made by the Django app to the memcached server (lsof show hundrets of open
 descriptors). After some time the app process had been killed by the
 system, due to exceeded number of opened file descriptors.

 Look at Google pointed me to the ticket #15324. Since that patch has been
 incorporated in the Django 1.3.1, I have started digging into memcached
 Django wrapper over the pyton-memcached module
 (django.core.cache.backends.memcached). What I found is that Django app
 run in multithreaded mode creates new cache object for every thread. This
 is probably good information, since it has allowed avoid difficult race
 conditions. What is sad - after closing/releasing the thread, the cache
 object is somehow not deleted properly. I mean it seems that it does not
 clean up all gathered resources properly. This lasts with large number of
 opened file descriptors in the memcached case.

 I have added simple patch fixing said behaviour. It works quite well for
 me, thus I assume I could be considered to be improved and somehow merged
 with the Django sources. I have not created any tests, I am sorry for
 that.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17943>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to