loguru in flask app hosted at pythonanywhere crashes the uWSGI workers

77 Views Asked by At

I have a very simple Flask app running on pyhtonanywhere at hacker level account. When I send a load to below code due to enqueue option in file logger below crash happens. The log file does not contain any not found errors. Any idea on the root cause ?

logger.add(
    "logs/app.log", level="DEBUG", rotation="50 MB", compression="zip", enqueue=True
)

def page_not_found(error):
    logger.warning(error)
    return render_template("not-found.html", title="404"), 404
- *** HARAKIRI ON WORKER 1 (pid: 4, try: 1) ***
- HARAKIRI !!! worker 1 status !!!
- HARAKIRI [core 0] 10.0.0.75 - GET /2 since 1700589665
- HARAKIRI !!! end of worker 1 status !!!
DAMN ! worker 1 (pid: 4) died, killed by signal 9 :( trying respawn ...
Respawned uWSGI worker 1 (new pid: 12)
spawned 2 offload threads for uWSGI worker 1
- *** HARAKIRI ON WORKER 2 (pid: 7, try: 1) ***
- HARAKIRI !!! worker 2 status !!!
- HARAKIRI [core 0] 10.0.0.75 - GET /temp since 1700589782
- HARAKIRI !!! end of worker 2 status !!!
DAMN ! worker 2 (pid: 7) died, killed by signal 9 :( trying respawn ...
Respawned uWSGI worker 2 (new pid: 15)
pawned 2 offload threads for uWSGI worker 2

I have checked documentation for both pythonanywhere and loguru but couldn't figure out how a multiprocessing queue results in a uWSGI crash.

When I set the logger enqueue option to False the same load does not crash the app.

0

There are 0 best solutions below