Django leaking a file descriptor.

55 views
Skip to first unread message

jikanter

unread,
Mar 28, 2008, 1:10:25 AM3/28/08
to Django developers
I am pretty sure django is leaking a file descriptor, and the closest
thing I could come to was was ticket #6482.

localhost:~ jikanter$ curl http://test/
curl: (52) Empty reply from server

localhost:~ jikanter$ ps auxw |grep httpd
root 16497 0.0 -0.1 42560 2864 ?? Ss 6:44PM 0:00.88 /
Users/jikanter/apache_dir/bin/httpd -k restart
root 16688 0.0 -0.0 28932 832 ?? S 7:22PM 0:00.39 /
Users/jikanter/src/lighttpd/lighttpd-1.4.18/src/.libs/lighttp
jikanter 16709 0.0 -0.1 31996 2812 q2 S+ 7:25PM 0:00.05
vim extra/httpd-vhosts.conf
www-data 17702 0.0 -0.0 33416 936 ?? S 11:53PM 0:00.00 /
Users/jikanter/apache_dir/bin/httpd -k restart
www-data 17703 0.0 -0.0 33416 936 ?? S 11:53PM 0:00.00 /
Users/jikanter/apache_dir/bin/httpd -k restart
www-data 17705 0.0 -0.1 33416 1300 ?? S 11:53PM 0:00.00 /
Users/jikanter/apache_dir/bin/httpd -k restart
www-data 17706 0.0 -0.0 33416 936 ?? S 11:53PM 0:00.00 /
Users/jikanter/apache_dir/bin/httpd -k restart
www-data 17709 0.0 -0.0 33416 1016 ?? S 11:53PM 0:00.00 /
Users/jikanter/apache_dir/bin/httpd -k restart
jikanter 17712 0.0 -0.0 27368 448 pd S+ 11:53PM 0:00.00
grep httpd


change the third line of django/__init__.py to

assert False, "wa-wah-wee-wah"


localhost:~ jikanter$ sudo apache_dir/bin/apachectl -k restart
httpd: Could not reliably determine the server's fully qualified
domain name, using ::1 for ServerName

localhost:~ jikanter$ curl http://test/

<pre>
MOD_PYTHON ERROR

ProcessId: 17720
Interpreter: 'python1'

ServerName: 'test.genetictree.net'
DocumentRoot: '/Users/jikanter/public_html/'

URI: '/'
Location: '/'
Directory: None
Filename: '/Users/jikanter/public_html/'
PathInfo: ''

Phase: 'PythonHandler'
Handler: 'mywsgiserver'

Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/mod_python/importer.py", line 1537, in
HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/mod_python/importer.py", line 1202, in
_process_target
module = import_module(module_name, path=path)

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/mod_python/importer.py", line 304, in
import_module
return __import__(module_name, {}, {}, ['*'])

File "/Users/jikanter/public_html/mywsgiserver.py", line 2, in
&lt;module&gt;
from django.core.handlers import modpython

File "/Users/jikanter/public_html/django/__init__.py", line 4, in
&lt;module&gt;
assert False, 'wa-wa-wee-wah'

AssertionError: wa-wa-wee-wah

</pre>

Has anyone experienced something similar?

mod_python works fine without django, and the django serves files
correctly without apache.

does anyone mind if ticket #6482 was reopened?

Thomas Guettler

unread,
Mar 28, 2008, 3:15:24 AM3/28/08
to django-d...@googlegroups.com
Your post contains a lot of lines, but I don't see where the leaking
files descriptor should be.

You can find the open files with this command line (linux). You need to
modify the -C parameter
to fit your binary.

ps -C httpd2-prefork -opid= | while read pid; do ls -l /proc/$pid/fd/*;
done | grep -vE '/dev/null|socket:|pipe:|deleted|/var/log|inode:'

What files are left open?

I think it is a bad to put all open calls into a try: ...finally blocks.
But it could be necessary
in some places.

jikanter schrieb:


--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

Reply all
Reply to author
Forward
0 new messages