i am using google app engine on my server (listen --address=0.0.0.0 all network) my application a short time correctyl(i get some users input, some process,show the data and insert mysql db) after i take this error message and web browser didn't show anything, my system: google app engine, python 2.7, mysql(via rdbms) i change the port(8080,8091,8090vs...) or restart app engine, my applicayion again work but after then again same error message
Traceback (most recent call last):
File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2734, in __init__
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "C:\Python27\lib\SocketServer.py", line 639, in __init__
self.handle()
File "C:\Python27\lib\BaseHTTPServer.py", line 343, in handle
self.handle_one_request()
File "C:\Python27\lib\BaseHTTPServer.py", line 313, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "C:\Python27\lib\socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054]
Try switching to a more serious networking framework, not based on a toy HTTP server (BaseHTTPServer is a toy HTTP server).
10054 is the Windows error ECONNRESET. This indicates that the connection your HTTP server is trying to read from has been closed. It's not exactly an error condition - connections get closed, it's a normal part of their lifecycle - but the Google AppEngine (development!) server you're using seems to be treating it as an error. Perhaps in doing so it ends up responding incorrectly to other requests as well.
A correct HTTP server will not have a problem dealing with this situation.
The AppEngine development server is indeed pretty limited (single-threaded, HTTP 1.0 only, not robust to connection resets), but it is the only option for emulating in a local dev. environment the behavior of the production server, including stubs to AppEngine services and sandboxing of some modules (including os and socket).
Until Google provide us with a more robust alternative, I added exception handlers for the expected socket errors in the handle_one_request method of BaseHTTPServer.py (located in the Lib subdir of the Python installation directory)
[end of BaseHTTPServer.py::handle_one_request() - Python 2.7]
except socket.error as socket_error:
import errno
if socket_error.errno in (errno.ECONNABORTED, errno.WSAECONNABORTED, errno.ECONNRESET, errno.WSAECONNRESET):
pass
else:
raise
ECONNABORTED/WSAECONNABORTED is happening on remote disconnects - see Python issue 14574 for details.
Related
I'm creating a web app using React in the frontend and Django in the backend. I used this blog to integrate react with backend. However I get a strange error called
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
I searched the internet a lot found this question, did what the answer says but the problem persists. I don't think the database has something to do with my issue, because the pure django pages work fine but only react powered page throw this error. I found a question that is closest to mine, this one, but the question is unanswered, and apparently the problem is with loading some media page, but I just want to load <h1>Hello World!</h1>. Here's full traceback
Traceback (most recent call last):
File "c:\users\ilqar\appdata\local\programs\python\python38-32\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "c:\users\ilqar\appdata\local\programs\python\python38-32\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\users\ilqar\appdata\local\programs\python\python38-32\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Users\Ilqar\.virtualenvs\django-react-reddit-XsnOy92e\lib\site-packages\django\core\servers\basehttp.py", line 174, in handle
self.handle_one_request()
File "C:\Users\Ilqar\.virtualenvs\django-react-reddit-XsnOy92e\lib\site-packages\django\core\servers\basehttp.py", line 182, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "c:\users\ilqar\appdata\local\programs\python\python38-32\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
By the way, I did not include the code because it is exactly the same as in that blog.(except models and stuff, I don't do any api calls or something just Hello World!.
And I also tried to turn off firewall and try, but the result was the same, error is persisting.
I have debug_toolbar in my INSTALLED_APPS so it shows in the every page. Strangely only React side of page is not rendered, all the others, including debug toolbar, page title and stuff is there.
So what can I do about this?
Thanks in advance.
I had a similar problem, and putting the event.preventDefault(); in the submit event; I had no more problems
This logs, quite repeatedly, every time my app loads on my computer.
Exception happened during processing of request from ('127.0.0.1', 53597)
Traceback (most recent call last):
File "/usr/local/Cellar/python#3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/Cellar/python#3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/Cellar/python#3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 720, in __init__
self.handle()
File "/usr/local/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 174, in handle
self.handle_one_request()
File "/usr/local/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 182, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "/usr/local/Cellar/python#3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 669, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer
I realize that this has been posted on extensively over the years, but it seems to me that the consensus on the answer is that it could be one of a few things:
(a) Using a .png instead of an .ico in a favicon
(b) Misusing {% static %}
(c) Misusing event.preventDefault()
Unfortunately for me, none of those things have happened in the last few weeks in my teams commits. So I ask, are there other solutions I may be missing? This is a result of me recently merging with a master development branch.
As I mentioned over here, I had this issue show up while debugging POST DRF api endpoints.
The solution was to add SITE_URL to settings with my localhost and dev server port set, i.e.
SITE_URL = "http://localhost:4000"
Commonly this error is associated with a missing favicon file. But I'm not sure if this change gets around that issue or is due to something else.
For added context, I hit this error while using Pycharm's http request scratch file to debug and validate DRF (django rest framework) endpoints.
The format I was using was:
### Send POST request with json body
POST http://localhost:4000/api/admin/add_node/
Content-Type: application/json
Authorization: Basic admin password
{
"name": "node01",
"username": "username",
"password": "password"
}
Now I use flask to develop web app.
But at first it works well,after operating web page for a while,the flask back-end shows error like these:
File "/usr/lib64/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/usr/lib/python2.6/site-packages/werkzeug/serving.py", line 251, in handle_one_request
return self.run_wsgi()
File "/usr/lib/python2.6/site-packages/werkzeug/serving.py", line 193, in run_wsgi
execute(self.server.app)
File "/usr/lib/python2.6/site-packages/werkzeug/serving.py", line 184, in execute
write(data)
File "/usr/lib/python2.6/site-packages/werkzeug/serving.py", line 152, in write
self.send_header(key, value)
File "/usr/lib64/python2.6/BaseHTTPServer.py", line 390, in send_header
self.wfile.write("%s: %s\r\n" % (keyword, value))
IOError: [Errno 32] Broken pipe
My app run on port 5000 app.run(debug=True,port=5000),
I use nginx as web server,and set proxy_pass http://127.0.0.1:5000 in nginx config file.
Now I really don't know where is the wrong,I use session['email'] = request.form['email'] and in other file I use email = session.get('email').
Is this usage right? How to set session active period?
or any other reason cause this error ?
then I set app.run(debug=False,port=5000),it shows new error
File "/usr/lib64/python2.6/SocketServer.py", line 671, in finish
self.wfile.flush()
File "/usr/lib64/python2.6/socket.py", line 303, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
socket.error: [Errno 32] Broken pipe
why ?
Please help me,thks.
The built-in werkzeug server is not capable of handling the remote end closing the connection while the server is still churing its content out.
instead of app.run(debug=True,port=5000)
try
from gevent.wsgi import WSGIServer
http_server = WSGIServer(('', 5000), app)
http_server.serve_forever()
or if you are using nginx, use it with uwsgi as described here
It is rather a werkzeug issue I would argue
I've tried to render a animation using Network Render. I connected my PC an my Laptop without further problems. But when I clicked "Render animation on network" after some seconds the following error occurs:
AL lib: (EE) UpdateDeviceParams: Failed to set 44100hz, got 48000hz instead
Traceback (most recent call last):
File "F:\Program Files (x86)\Blender\2.74\scripts\addons\netrender\operat ors.py", line 85, in invoke
return self.execute(context)
File "F:\Program Files (x86)\Blender\2.74\scripts\addons\netrender\operat ors.py", line 77, in execute
scene.network_render.job_id = client.sendJob(conn, scene, True)
File "F:\Program Files (x86)\Blender\2.74\scripts\addons\netrender\client .py", line 121, in sendJob
return sendJobBlender(conn, scene, anim, can_save)
File "F:\Program Files (x86)\Blender\2.74\scripts\addons\netrender\client .py", line 340, in sendJobBlender
response = conn.getresponse()
File "F:\Program Files (x86)\Blender\2.74\python\lib\http\client.py", line 1172, in getresponse
response.begin()
File "F:\Program Files (x86)\Blender\2.74\python\lib\http\client.py", line 351, in begin
version, status, reason = self._read_status()
File "F:\Program Files (x86)\Blender\2.74\python\lib\http\client.py", line 313, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "F:\Program Files (x86)\Blender\2.74\python\lib\socket.py", line 371, inreadinto
return self._sock.recv_into(b)
socket.timeout: timed out
I asked Google: Somebody circumvents the problem by changing "the default timeout to 1000 (instead of 300) (in the socket.py file[...])". I can't find this line, I guess they changed it in the current version. Since I have no experience using python I do not know how I can change it now.
I hope you can help me!
The addon would be a better place to make the change instead of the socket module. If you look in your addons folder you will find netrender/utils.py where you will find a few lines that use socket.setdefaulttimeout and you could make some adjustments there.
An even better solution would be to look at why the connection is timing out, two computers in the same room should not get any timeouts. A common cause of timeouts is the inability to get a connection, firewalls are good at stopping connections, so you may want to check that the port used by network render is allowing incoming connections, and that blender is running with network render turned on to accept the connection. The default port is 8000 which could also be in use by another application, you can configure each computer to use a different port if needed.
I've been using Django 1.3 with Python 2.6 on Ubuntu 10.10. I have 3 questions.
I recall having this problem on Windows 7 when I used Django a while ago. However, I also remember that when I first used Django this problem didn't occur.
When I access Django via 127.0.0.1:8000, after starting a brand new project, I can reach the site, but sometimes it takes a good 10-20 secs and sometimes more to reach it. Also, on a project I've barely worked on, I have the same problems and also get errors like:
Exception happened during processing of request from ('127.0.0.1', 47758)
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-1.3-py2.6.egg/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
Also, whenever I get an error I expect dcramer's django-sentry to log the error in the database, but when I go into MySQL and check the tables, there is nothing there. I followed the instructions on the site to install the app.
I placed this in my urls.py file:
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/user/apache2/www/django/ecomstore/static',})
However, when I go to 127.0.0.1:8000/static/css.css I can't find the file I placed in the folder. What did I do wrong?
Thanks for all the help!
this issue is also discussed here Django + WebKit = Broken pipe
These errors are the client closing the connection before it has a chance to fully send all data (I believe).
There are certain areas of the stack, this being one of them, that Sentry currently can't log exceptions from. We're hoping to improve this in Sentry 2.0.
/Have you set STATIC_URL = '/static/' in your settings