Difficulty in understanding Uvicorn logs
See original GitHub issueI am facing an issue in Uvicorn where a background process is crashing the whole application intermittently. I want to understand the logs thrown by Uvicorn, as I am not able to reproduce this issue reliably.
Logs:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 184, in main_loop
should_exit = await self.on_tick(counter)
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "runner.py", line 8, in <module>
uvicorn.run(
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 386, in run
server.run()
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 48, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 68, in serve
await self.main_loop()
RuntimeError: coroutine raised StopIteration
Environment
- OS / Python / Uvicorn version: just run
uvicorn --version
:Running uvicorn 0.13.3 with CPython 3.8.5 on Linux
- The exact command you’re running uvicorn with, all flags you passed included: Programatically running Uvicorn,
uvicorn.run(
app,
host="0.0.0.0",
port=4000,
http="h11",
# Maintaining logging at application instead of uvicorn
access_log=False,
log_config=None
)
Additional context
- Application is using FastAPI, see http://fastapi.tiangolo.com/
- Started noticing this when I upgraded Couchbase SDK 3.0.8
- Have seen this site while debugging this issue: https://www.gitmemory.com/issue/coleifer/python-lsm-db/20/758081515
- My application starts a background scheduler before starting the Uvicorn application. See https://apscheduler.readthedocs.io/en/stable/
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How To Override Uvicorn Logger in FastAPI using Loguru
Generally it is very difficult to override default uvicorn logs. When one deploys an application using Uvicorn, this is how the default logs...
Read more >FastAPI uvicorn not logging errors - Stack Overflow
I'm on it... I am currently tracing it back to the "uvicorn.error" logger which logs to stderr by default, but I got the...
Read more >tiangolo/fastapi - Gitter
Something in your logging configuration is off. It looks to me like you have two handlers. One attached to the root logger and...
Read more >How to Add Timestamp to FastAPI/Uvicorn Logs
... you will learn to configure Uvicorn and add timestamp to all the access and debug logs. Let's have a look at the...
Read more >Settings - Uvicorn
Defaults to the $WEB_CONCURRENCY environment variable if available, or 1. Logging¶. --log-config <path> - Logging configuration file. Options: dictConfig() ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am facing this issue in an enterprise code, and as I said before I was not able to reproduce this issue in an example. I was more looking into some insights of the logs, so I could understand the error better. See if you can help me out in this, like for example what is happening in the logs.
ok, let me see if i can provide more details or make this issue reproducible. closing this ticket for now.