Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the Django development server hang on this admin tool JS file?

Periodically, when using the Django admin tool, it hangs and stops responding to requests until it is restarted. Whenever it hangs, the last line in the log is:

"GET /admin/jsi18n/ HTTP/1.1" 200 2158

The hang seems to occur after a POST (like when viewing the results of adding an object). It happens with a variety of different models and is unpredictable, as far as I can tell. The only constant is the GET request to that Javascript file. Also, the time between hangs varies: sometimes you can add objects with the admin tool for an hour, sometimes it can't last 5 minutes.

Performance-wise, the box does not appear to be under much stress (load average of 0.17-0.20)

[EDIT] It recently output an error that looks interesting, though it recovered itself and kept serving responses afterwards:

[18/Aug/2011 13:19:50] "GET /admin/jsi18n/ HTTP/1.1" 200 2158
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 284, in run
self.finish_response()
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 324, in finish_response
self.write(data)
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 420, in write
self._write(data)
File "/usr/lib/python2.6/socket.py", line 300, in write
self.flush()
File "/usr/lib/python2.6/socket.py", line 286, in flush
self._sock.sendall(buffer)
error: [Errno 32] Broken pipe
like image 891
shiftycow Avatar asked Aug 18 '11 19:08

shiftycow


1 Answers

Most likely this is because of you using Google Chrome. Which will make more then one connection to a web-server, which in the case of the Django Dev server it's no good. You have two options. Either use

  • Django Concurrent Server
  • Setup your dev-server using a production server (Don't recommend, more complex)
  • Use Firefox, tell Chrome to stop multiple connections
  • Host your static files on your computer using a separate server. Like Lighttpd or something.
like image 186
stormlifter Avatar answered Nov 15 '22 05:11

stormlifter