Question

ConnectionResetError: [Errno 104] Connection reset by peer

ERROR:flask.app:Exception on / [GET]
Oct 28 11:35:26 pythongram gunicorn[1518]: Traceback (most recent call last):
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 600, in urlopen
Oct 28 11:35:26 pythongram gunicorn[1518]:     chunked=chunked)
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 384, in _make_request
Oct 28 11:35:26 pythongram gunicorn[1518]:     six.raise_from(e, None)
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "<string>", line 2, in raise_from
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 380, in _make_request
Oct 28 11:35:26 pythongram gunicorn[1518]:     httplib_response = conn.getresponse()
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
Oct 28 11:35:26 pythongram gunicorn[1518]:     response.begin()
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/usr/lib/python3.5/http/client.py", line 297, in begin
Oct 28 11:35:26 pythongram gunicorn[1518]:     version, status, reason = self._read_status()
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
Oct 28 11:35:26 pythongram gunicorn[1518]:     line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/usr/lib/python3.5/socket.py", line 575, in readinto
Oct 28 11:35:26 pythongram gunicorn[1518]:     return self._sock.recv_into(b)
Oct 28 11:35:26 pythongram gunicorn[1518]: ConnectionResetError: [Errno 104] Connection reset by peer
Oct 28 11:35:26 pythongram gunicorn[1518]: During handling of the above exception, another exception occurred:
Oct 28 11:35:26 pythongram gunicorn[1518]: Traceback (most recent call last):
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/flask/app.py", line 2292, in wsgi_app
Oct 28 11:35:26 pythongram gunicorn[1518]:     response = self.full_dispatch_request()
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/flask/app.py", line 1815, in full_dispatch_request
Oct 28 11:35:26 pythongram gunicorn[1518]:     rv = self.handle_user_exception(e)
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/flask/app.py", line 1718, in handle_user_exception
Oct 28 11:35:26 pythongram gunicorn[1518]:     reraise(exc_type, exc_value, tb)
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/flask/_compat.py", line 35, in reraise
Oct 28 11:35:26 pythongram gunicorn[1518]:     raise value
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/flask/app.py", line 1813, in full_dispatch_request
Oct 28 11:35:26 pythongram gunicorn[1518]:     rv = self.dispatch_request()
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/venv/lib/python3.5/site-packages/flask/app.py", line 1799, in dispatch_request
Oct 28 11:35:26 pythongram gunicorn[1518]:     return self.view_functions[rule.endpoint](**req.view_args)
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/hg.py", line 10, in hello
Oct 28 11:35:26 pythongram gunicorn[1518]:     test_like()
Oct 28 11:35:26 pythongram gunicorn[1518]:   File "/home/apps/hg/hg.py", line 19, in test_like

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
July 2, 2022

Hi there,

It looks like the request that you are making is timing out. Can you share the code snippet that you are using for this specific request?

Besides, as a general suggestion, in case that you are connecting to a database, make sure that the database cluster is accessible from the server that you are running your Flask application on:

https://docs.digitalocean.com/products/app-platform/how-to/manage-databases/#create-a-database

Best,

Bobby