nginx Errno 32: Broken Pipe with certain requests - python

I've got an NGINX/flask/Docker server using:
https://github.com/tiangolo/uwsgi-nginx-flask-docker
and it works for running small and infrequent requests. But if I try a number of large requests that involve downloading ~5mb worth of data from amazon s3 for each (lets say, 10 at once). I get this error:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 659, in inner
srv.serve_forever()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 499, in serve_forever
HTTPServer.serve_forever(self)
File "/usr/local/lib/python2.7/SocketServer.py", line 233, in serve_forever
self._handle_request_noblock()
File "/usr/local/lib/python2.7/SocketServer.py", line 292, in _handle_request_noblock
self.handle_error(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 318, in process_request
self.finish_request(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.7/SocketServer.py", line 652, in __init__
self.handle()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 216, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 251, in handle_one_request
return self.run_wsgi()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 193, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 184, in execute
write(data)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in write
self.wfile.write(data)
IOError: [Errno 32] Broken pipe
I've tried adding more processes and threads to nginx/wsgi. My uwsgi.ini looks like so:
[uwsgi]
module = main
callable = application
processes = 8
threads = 2
and my nginx.conf looks like this:
server {
location / {
try_files $uri #app;
}
location #app {
include uwsgi_params;
uwsgi_pass unix:///tmp/uwsgi.sock;
}
location /static {
alias /app/static;
}
}
Does anyone know what might be causing this?

Related

How to fix OSError when running Flask scripts

When running Flask scripts in localhost, I tried to access the webpages from another device in the same local network.
Although I'm able to view the webpages, I frequently noticed this error popping all of a sudden with random numbers near my IP in my console causing OSError and denying access for my later requests to the Flask server.
Exception happened during processing of request from ('192.168.0.4', 41252)
Exception happened during processing of request from ('192.168.0.4', 41250)
Traceback (most recent call last):
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Program Files\Python38\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Program Files\Python38\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Program Files\Python38\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Program Files\Python38\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 329, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "C:\Program Files\Python38\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Program Files\Python38\lib\http\server.py", line 426, in handle
self.handle_one_request()
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 329, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "C:\Program Files\Python38\lib\http\server.py", line 426, in handle
self.handle_one_request()
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 360, in handle_one_request
self.raw_requestline = self.rfile.readline()
File "C:\Program Files\Python38\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 360, in handle_one_request
self.raw_requestline = self.rfile.readline()
File "C:\Program Files\Python38\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
OSError: [WinError 10022] An invalid argument was supplied
OSError: [WinError 10022] An invalid argument was supplied
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.4', 41378)
Exception happened during processing of request from ('192.168.0.4', 41380)
Traceback (most recent call last):
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Program Files\Python38\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Program Files\Python38\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Program Files\Python38\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Program Files\Python38\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Program Files\Python38\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 329, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 329, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "C:\Program Files\Python38\lib\http\server.py", line 426, in handle
self.handle_one_request()
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 360, in handle_one_request
self.raw_requestline = self.rfile.readline()
File "C:\Program Files\Python38\lib\http\server.py", line 426, in handle
self.handle_one_request()
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 360, in handle_one_request
self.raw_requestline = self.rfile.readline()
File "C:\Program Files\Python38\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "C:\Program Files\Python38\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
OSError: [WinError 10022] An invalid argument was supplied
OSError: [WinError 10022] An invalid argument was supplied
----------------------------------------
----------------------------------------
For all I know, I know nothing about sockets or other things thats in my error.
How do i stop such errors from happenning after all I'm just rendering a HTML template as a response?
Edit :
I'm adding a part of my Flask script here from which I still get the error. And again the error is something that occurs when I try to access my webpages from other devices connected in the network
from flask import *
app = Flask(__name__)
#app.route('/')
def index():
return render_template("home.html")
#app.route('/download')
def downloads():
return render_template("downloads.html")
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000 , debug = True)
This time also I got similar error as follows
----------------------------------------
Exception happened during processing of request from ('192.168.0.5', 42834)
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Program Files\Python38\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Program Files\Python38\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 329, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "C:\Program Files\Python38\lib\http\server.py", line 426, in handle
self.handle_one_request()
File "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\werkzeug\serving.py", line 360, in handle_one_request
self.raw_requestline = self.rfile.readline()
File "C:\Program Files\Python38\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
OSError: [WinError 10022] An invalid argument was supplied
----------------------------------------

IOError: [Errno 104] Connection reset by peer

I'm sending a file with the following route
#app.route('/file/')
#db_session
def file():
filename = request.args.get('filename')
response = make_response(filename)
response.headers['Content-Type'] = 'video/mp3'
response.headers["Content-Disposition"] = 'attachment; filename=%s' % filename
response.headers['Content-Length'] = os.path.getsize(filename)
response.headers["X-Accel-Redirect"] = '%s' % filename
return send_file(
filename,
mimetype="audio/mp3",
as_attachment=True,
attachment_filename="%s" % filename)
It works fine in most desktop browsers and some mobile browsers. But on others it does not, and I get this error
68.9.161.152 - - [13/Dec/2015 05:27:24] "GET /mp4/?filename=video/How_To_Shave_Your_Beard_Like_A_Man.mp4 HTTP/1.1" 200 -
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/www/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 653, in inner
fd=fd).serve_forever()
File "/home/www/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 505, in serve_forever
HTTPServer.serve_forever(self)
File "/usr/lib/python2.7/SocketServer.py", line 238, in serve_forever
self._handle_request_noblock()
File "/usr/lib/python2.7/SocketServer.py", line 297, in _handle_request_noblock
self.handle_error(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
self.handle()
File "/home/www/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 217, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/home/www/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 252, in handle_one_request
return self.run_wsgi()
File "/home/www/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 194, in run_wsgi
execute(self.server.app)
File "/home/www/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 185, in execute
write(data)
File "/home/www/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 166, in write
self.wfile.write(data)
I've tried putting time.sleep(1) randomly in order to try and help.

Python Bottle framework becoming non-responsive

I am having some problem with using python's Bottle framework(http://bottlepy.org/docs/dev/index.html) to host a webpage. It seems to work fine for certain period of time but now and then I get the following error and it fails to show the webpage. The script doesn't crash but the webpage becomes non responsive.
Any suggestions?
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
I also see the following error. But I'm guessing these occur if a request to a non-existent webpage/object is requested-
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
self.handle()
File "/usr/lib/python2.7/wsgiref/simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "/usr/lib/python2.7/socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 104] Connection reset by peer
This question seems to be similar to How to prevent errno 32 broken pipe?
You received a SIGPIPE and this could be due to attempting to write to a closed socket. You could try to handle the exception with something like that:
except socket.error, e:
if isinstance(e.args, tuple):
print "Errno: %d" % e[0]
if e[0] == errno.EPIPE:
# Caught a peer disconnection
print "Remote host disconnected"

Django: 503 Service Unavailable

Related:
I am total new to Python and its frameworks. Just trying some hands on Django after some Python fundamentals.
Problem:
Right now I am trying to run Django server after first installation. The server runs without any error but when I try to visit the web page I get 503 Service Unavailable Error on http://127.0.0.1:8000/ and the server shuts down automatically.
Server Runs but errors after request:
D:\Code\Outer_Dir>manage.py runserver
Validating models...
0 errors found
December 23, 2013 - 21:51:36
Django version 1.6.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
^C
D:\Code\Outer_Dir>manage.py runserver
Validating models...
0 errors found
December 23, 2013 - 21:55:21
Django version 1.6.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[23/Dec/2013 21:55:26] "GET / HTTP/1.1" 200 1757
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
[23/Dec/2013 21:55:26] "GET / HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58251)
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python33\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python33\lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\socketserver.py", line 610, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python33\lib\socketserver.py", line 345, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py", line 126
, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python33\lib\socketserver.py", line 666, in __init__
self.handle()
File "C:\Python33\lib\wsgiref\simple_server.py", line 126, in handle
handler.run(self.server.get_app())
File "C:\Python33\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python33\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58252)
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python33\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python33\lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\socketserver.py", line 610, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python33\lib\socketserver.py", line 345, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py", line 126
, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python33\lib\socketserver.py", line 666, in __init__
self.handle()
File "C:\Python33\lib\wsgiref\simple_server.py", line 126, in handle
handler.run(self.server.get_app())
File "C:\Python33\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python33\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

Urllib2 - Django - Broken Pipe

I am new to Django and I am experiencing some troubles posting data to a django webapp.
On the django side I have a form (backed by couchdb - couchdbkit django ext.).
On the client side I post data with urllib2, in bulk (going through a list of data to post one by one)
data = urllib.urlencode(param)
req = urllib2.Request(OBJECT_SERVICE_URL + '/objects/create/', data)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
res = urllib2.urlopen(req)
res.close()
After one record (one post passing), it get the message below, running again the next line passes and I have again this message :
res = urllib2.urlopen(req)
File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.6/urllib2.py", line 397, in open
response = meth(req, response)
File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.6/urllib2.py", line 435, in error
return self._call_chain(*args)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: INTERNAL SERVER ERROR
The server says :
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 318, in write
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59571)
self.flush()
File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 104] Connection reset by peer
Traceback (most recent call last):
File "/usr/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
----------------------------------------
self.process_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 570, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
self.finish()
File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
self.wfile.flush()
File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe
I must state that I am working on the embedded django development web server...
And here is the output of the test :
======================================================================
ERROR: test_create_object (objects.tests.ObjectAppTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/patrick/workspace_py/objects/tests.py", line 21, in test_create_object
rs = c.post('/objects/create/', param)
File "/usr/local/lib/python2.6/dist-packages/django/test/client.py", line 455, in post
response = super(Client, self).post(path, data=data, content_type=content_type, **extra)
File "/usr/local/lib/python2.6/dist-packages/django/test/client.py", line 256, in post
return self.request(**r)
File "/usr/local/lib/python2.6/dist-packages/django/test/client.py", line 387, in request
response = self.handler(environ)
File "/usr/local/lib/python2.6/dist-packages/django/test/client.py", line 84, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 169, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 218, in handle_uncaught_exception
return callback(request, **param_dict)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/coffin/views/defaults.py", line 34, in server_error
content = render_to_string(template_name, Context({}))
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/coffin/template/loader.py", line 50, in render_to_string
template = get_template(template_name)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/coffin/template/loader.py", line 24, in get_template
return env.get_template(template_name)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/jinja2/environment.py", line 719, in get_template
return self._load_template(name, self.make_globals(globals))
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/jinja2/environment.py", line 693, in _load_template
template = self.loader.load(self, name, globals)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/jinja2/loaders.py", line 115, in load
source, filename, uptodate = self.get_source(environment, name)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/jinja2/loaders.py", line 377, in get_source
raise TemplateNotFound(template)
TemplateNotFound: 500.html
----------------------------------------------------------------------
Does anyone know how to fix ?
Patrick
Some times I found weird errors and quick connection resets using development server (like in your log). If your application is about http, REST and webservices you should use Apache or Gunicorn so you feel a more realistic enviroment while developing.

Categories