Django runserver sigue agotando el tiempo de espera en osx lion

I'm having issues with runserver on osx lion. Static assets won't transfer randomly, and I occasionally get this message:

Exception happened during processing of request from ('', 57555)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 310, in process_request
    self.finish_request(request, client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/Users/ehutch79/pyenv/sd/lib/python2.7/site-packages/django/core/servers/", line 570, in __init__
    BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 639, in __init__
  File "/Users/ehutch79/pyenv/sd/lib/python2.7/site-packages/django/core/servers/", line 610, in handle
    self.raw_requestline = self.rfile.readline()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 447, in readline
    data = self._sock.recv(self._rbufsize)
timeout: timed out

It's very inconsistant. Google searches have revealed nothing. Does anyone have any idea what might be causing it?

It doesn't seem to be the browser, as i've seen it in both chrome, locally, and ie and chrome on a remote box.

preguntado el 01 de febrero de 12 a las 14:02

1 Respuestas

The dev server is monothreaded, so if 2 connections are made at the same time, and are blocking, they will wait forever on each other. Make sure you don't have such a problem:

  • check if you have some settings that can trigger two connections at the same time (some plugin, or some javascript that make connections implicitly).
  • check if you have some views that are accessing the same blocking ressource at the same times.

It happened to me recently, when trying to test a SOAP calls from my own code to my own code, urllib was opening from a view an url triggering another view.

Sometimes, it's not accessing blocking ressources, but the concurrency make the requests very slow and so it times out. E.G: you have two browsers pointed to the same devserver and they are doing aggressive HTTP KeepAlive.

There is nothing to do, except using something else to test these specific features, such as gunicorn or werkzeug. For werzeug, install extensiones de django, y use ./ runserver_plus --threaded

Respondido 01 Feb 12, 18:02

So far no issues, it looks like this was the issue. - conejera

since it was already mentioned- using gunicorn with the run_gunicorn is just as easy as using Django's runserver command. I don't think I've used the built-in server in development for a long time - j_syk

Yes, the only advantage of django-exntension werzeug integration over gunicorn is that is you use pdb, you don't have to worry about the timeout. Plus werkzeug got this nice debug terminal embeded in 505 error page in debug mode, making debugging very easy. - e-satis

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.