Open codeape2 opened 3 years ago
A minimal wsgi app also fails:
def simplest_wsgi_app(environ, start_response):
print(environ)
start_response('200 OK', [('Content-Type', 'text/plain')])
return [b"hello from wsgi!\n"]
With TypeError: can't pickle _asyncio.Future objects
The minimal wsgi app works if I use a modified WSGIHandler:
class MultiprocessCompatibleWSGIHandler(WSGIHandler):
def _get_environ(self, request, body, content_length):
environ = super()._get_environ(request, body, content_length)
del environ['asyncio.loop']
del environ['asyncio.executor']
del environ['aiohttp.request']
return environ
... but flask does not work. I guess serializing the entire flask application is not feasible. A possible approach for using a ProcessPool executor is to initialize the wsgi app in the process pool's initializer.
To reproduce:
Traceback: