EOF error shown

I am deploying an app where it will send email with image attachments to the recipient via Flask-Mail. It works fine when I run it locally on my machine port, however there’s a problem when it is run on Render.

Mar 22 01:41:59 AM  [2023-03-21 17:41:59 +0000] [67] [ERROR] Socket error processing request.
Mar 22 01:41:59 AM  Traceback (most recent call last):
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle
Mar 22 01:41:59 AM      self.handle_request(listener, req, client, addr)
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 194, in handle_request
Mar 22 01:41:59 AM      util.reraise(*sys.exc_info())
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/gunicorn/util.py", line 626, in reraise
Mar 22 01:41:59 AM      raise value
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
Mar 22 01:41:59 AM      respiter = self.wsgi(environ, resp.start_response)
Mar 22 01:41:59 AM                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py", line 2551, in __call__
Mar 22 01:41:59 AM      return self.wsgi_app(environ, start_response)
Mar 22 01:41:59 AM             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py", line 2531, in wsgi_app
Mar 22 01:41:59 AM      response = self.handle_exception(e)
Mar 22 01:41:59 AM                 ^^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
Mar 22 01:41:59 AM      response = self.full_dispatch_request()
Mar 22 01:41:59 AM                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
Mar 22 01:41:59 AM      rv = self.handle_user_exception(e)
Mar 22 01:41:59 AM           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
Mar 22 01:41:59 AM      rv = self.dispatch_request()
Mar 22 01:41:59 AM           ^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
Mar 22 01:41:59 AM      return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
Mar 22 01:41:59 AM             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/dga/auth_utils.py", line 10, in decorated_function
Mar 22 01:41:59 AM      return f(*args, **kwargs)
Mar 22 01:41:59 AM             ^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/dga/rtdatabase.py", line 148, in records
Mar 22 01:41:59 AM      with app.open_resource("static\\images\\dt1.png") as fp:
Mar 22 01:41:59 AM           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM    File "/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/scaffold.py", line 369, in open_resource
Mar 22 01:41:59 AM      return open(os.path.join(self.root_path, resource), mode)
Mar 22 01:41:59 AM             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 22 01:41:59 AM  FileNotFoundError: [Errno 2] No such file or directory: '/opt/render/project/src/dga/static\\images\\dt1.png'

I was also shown EOF after clicking the send email button. Any help is appreciated.

1 Like

Hi,

The issue in your shared logs appears to be:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/render/project/src/dga/static\\images\\dt1.png'

Looks like you may have a path using both Windows & Linux syntax there.

EOF is usually shown when gunicorn times out. You could either raise the timeout or make sure you responses don’t take too long.

You also mentioned “mail”, which also makes me think you might be trying to use port 25, that is blocked and won’t work. You’ll need to use another port for mail.

Alan

The problem was indeed rooted from the fact that I tried to use both Windows & Linux syntax without knowing. Changing all to forward slash solved the problem. Thanks for the help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.