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 ('127.0.0.1', 57555)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/ehutch79/pyenv/sd/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 570, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 639, in __init__
self.handle()
File "/Users/ehutch79/pyenv/sd/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 610, in handle
self.raw_requestline = self.rfile.readline()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", 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.
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:
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 django-extensions, and use
./manage.py runserver_plus --threaded