gevent cooperative multitasking appears to break Connexion v3 FlaskApp? #1998
-
|
I am trying to upgrade an app from Connexion v2 to v3. The old app uses the FlaskApp and gevent-provided cooperative multi-tasking so the server can process multiple requests in parallel. The old approach of calling the To reproduce the behavior, find the Connexion Install the prereqs and starting the server: The startup takes a second longer than before, but no complaints appear. Then try to load the Swagger UI at http://127.0.0.1:8080/openapi/ui/ In my experience this /never finishes/ it just loads forever. Then hit Ctrl-C to interrupt the server. It responds Versions: Python 3.12, connexion 3.1.0, flask 3.1.0 , gevent 24.11.1. Is this enough information? Please advise, thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
I hope someone will comment on the breakage. Maybe the connexion migration guide should mention this? I expect I'm not the only person trying to migrate a Connexion v2 app who chose to use I tried using |
Beta Was this translation helpful? Give feedback.
-
|
From my (very limited) experience, a lot of flask-centric implementations need a big overhaul when switching to Connexion 3. That being said: Are you sure you really need gevent? (also with Connexion 2.x) However if you just want to process a few requests in parallel and you don't need all requests in the same process, there is the traditional approach of using gunicorn + multiple workers which is way less complex than using gevent. My gut feeling is that instead of gevent, you could use a full async app with Connexion 3. |
Beta Was this translation helpful? Give feedback.
-
|
@FelixSchwarz wrote:
I think this is the right answer. I'm closing this discussion. |
Beta Was this translation helpful? Give feedback.
From my (very limited) experience, a lot of flask-centric implementations need a big overhaul when switching to Connexion 3.
That being said: Are you sure you really need gevent? (also with Connexion 2.x)
I am a fan of gevent because it allowed me to use "async with colorless functions" and use libraries which were not designed for asynchronous use.
However if you just want to process a few requests in parallel and you don't need all requests in the same process, there is the traditional approach of using gunicorn + multiple workers which is way less complex than using gevent.
My gut feeling is that instead of gevent, you could use a full async app with Connexion 3.