Coder Social home page Coder Social logo

Comments (3)

tiangolo avatar tiangolo commented on June 22, 2024 1

Thanks for reporting back and closing the issue!

from uvicorn-gunicorn-fastapi-docker.

SansDK avatar SansDK commented on June 22, 2024

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.
Now, when I call an endpoint, I call a method in the imported module ('run()') which executes all the (long running) code.

The result is still the same. I also already tried making everything async / await with no luck.
This is the log with just 1 worker when calling the endpoint which crashes the worker:

[2019-06-04 12:05:11 +0000] [8] [INFO] ('172.17.0.1', 53413) - "GET /info HTTP/1.1" 200
Start training
Called long-running method 'run()' in module
[2019-06-04 12:05:20 +0000] [17] [INFO] Booting worker with pid: 17
email-validator not installed, email fields will be treated as str.
To install, run: pip install email-validator
[2019-06-04 12:05:27 +0000] [17] [INFO] Started server process [17]
[2019-06-04 12:05:27 +0000] [17] [INFO] Waiting for application startup.
[2019-06-04 12:05:27 +0000] [17] [DEBUG] ('172.17.0.1', 53429) - Connected
Start training
Called long-running method 'run()' in module
[2019-06-04 12:05:33 +0000] [21] [INFO] Booting worker with pid: 21
email-validator not installed, email fields will be treated as str.
To install, run: pip install email-validator
[2019-06-04 12:05:39 +0000] [21] [INFO] Started server process [21]
[2019-06-04 12:05:39 +0000] [21] [INFO] Waiting for application startup.

from uvicorn-gunicorn-fastapi-docker.

SansDK avatar SansDK commented on June 22, 2024

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.

from uvicorn-gunicorn-fastapi-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.