-
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Long running task with importlib crashes workers #10
Comments
I rewrote the module which I previously imported with importlib, so that I can import it at the beginning of the file without it executing all code. The result is still the same. I also already tried making everything async / await with no luck.
|
Seems that it was a (out-of-)memory problem which caused the workers to be restarted. It was really difficult to debug because it wasn't indicated anywhere, but in hindsight it sounds very logical and I should've paid attention to that before. For anyone who is running into similar problems; check your memory usage and allocation. |
Thanks for reporting back and closing the issue! |
Hey,
I'm running this image on a Kubernetes cluster and I have a simple FastAPI app in place. Everything basically works, except one thing. I'm using importlib to import some self made python file / lib as following:
This import runs a lot of code which takes a lot of time. But still, this is working fine when I'm running FastAPI locally, with this in the code:
But this seems to crash when doing this same thing in combination with Gunicorn (so, this image). Logs from the kubernetes pod:
On the /docs page, I get to see
TypeError: Failed to fetch
after the workers restart.I really don't know why this is happening. It looks like Importlib is not throwing any exception, and Gunicorn is also not logging any Critical Timeout error or anything like that.
I would greatly appreciate any help, thanks!
The text was updated successfully, but these errors were encountered: