loguru
loguru copied to clipboard
OSError: [Errno 9] Bad file descriptor
Python: 3.8.10 64bit Loguru: 0.5.3 OS: CentOS Linux release 7.9.2009 (Core) Traceback (most recent call last): File "/home/venv/lib/python3.8/site-packages/loguru/_handler.py", line 270, in _queued_writer message = queue.get() File "/usr/local/python3/lib/python3.8/multiprocessing/queues.py", line 356, in get res = self._reader.recv_bytes() File "/usr/local/python3/lib/python3.8/multiprocessing/connection.py", line 216, in recv_bytes buf = self._recv_bytes(maxlength) File "/usr/local/python3/lib/python3.8/multiprocessing/connection.py", line 414, in _recv_bytes buf = self._recv(4) File "/usr/local/python3/lib/python3.8/multiprocessing/connection.py", line 379, in _recv chunk = read(handle, remaining) OSError: [Errno 9] Bad file descriptor --- End of logging error --- --- Logging error in Loguru Handler #1 --- Record was: None
Hi.
Does this error occur randomly or every time a message is logged?
@Delgan I have such exception form some point for every logged message until the process killed (due to Bad file descriptor I guess). Attached the exceptions part from my log file loguru exceptions.log
I'm using version 0.5.3 with the following configuration:
from loguru import logger
logger.remove()
logger.add("hub.log",
colorize=True,
format="<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level:<8}| {message}</level>",
level="DEBUG",
rotation="50 MB", # Automatically rotate too big file
enqueue=True) # Process/thread safe logging
Can I protect my app from loguru errors with the API by adding a global exception handler or something similar?
Thanks!
The version I use is' 0.6.0 '. The following error will be prompted after the deployment of Linux docker. How to solve this problem?
--- Logging error in Loguru Handler #3 ---
Record was: None
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/loguru/_handler.py", line 272, in _queued_writer
message = queue.get()
File "/usr/local/lib/python3.9/multiprocessing/queues.py", line 366, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.9/multiprocessing/connection.py", line 221, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.9/multiprocessing/connection.py", line 419, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.9/multiprocessing/connection.py", line 384, in _recv
chunk = read(handle, remaining)
OSError: [Errno 9] Bad file descriptor
--- End of logging error ---
I have the same problem in version "0.7.2"
@middlestone Can you provide more info please, such as how often it occurs and whether a particular action triggers the error?
A fully reproducible example would be of great help. Right now, I can't say if it's a bug within Loguru or not.