Samagra-Development / Doc-Generator

Create PDFs from a variety of formats.
17 stars 46 forks source link

gunicorn throws OSError on ENOTCONN, this shuts down doc-gen worker #177

Open KDwevedi opened 11 months ago

KDwevedi commented 11 months ago

Description

NetGen Doc-Generator Deployment (branch v2) crashes with the following error:

samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    | Traceback (most recent call last):
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |   File "/usr/local/lib/python3.8/dist-packages/gunicorn/workers/gthread.py", line 274, in handle
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |     req = six.next(conn.parser)
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |   File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/parser.py", line 41, in __next__
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |     self.mesg = self.mesg_class(self.cfg, self.unreader, self.req_count)
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |   File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/message.py", line 181, in __init__
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |     super(Request, self).__init__(cfg, unreader)
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |   File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/message.py", line 54, in __init__
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |     unused = self.parse(self.unreader)
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |   File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/message.py", line 230, in parse
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |     self.headers = self.parse_headers(data[:idx])
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |   File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/message.py", line 74, in parse_headers
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    |     remote_addr = self.unreader.sock.getpeername()
samarth_doc-generator-web-service.1.lqanaq9h1t3v@e2e-78-177    | OSError: [Errno 107] Transport endpoint is not connected

This seems to be a known problem in versions of gunicorn older than 20.1.0 and was fixed in gunicorn pr #2277.

We're currently using an older version

Proposed Solution

The issue may be resolved by updating gunicorn and redeploying the service, resulting in increased stability.