-
Notifications
You must be signed in to change notification settings - Fork 711
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
Loguru leaving several shared memory file descriptors dangling when using enqueue #1098
Comments
Can you give more details about how More specifically: are you sure that |
Thank you for the prompt response. The I do not think the problem here is This behavior was only verified when using |
I'm facing the exact same issue with Python 3.11. Any developments here? |
Any chance to get a minimal reproducible example, please? I don't see what would cause such behavior, apart from inadvertent misuse of the logger. |
Issue Overview:
Within a multithreaded environment utilizing Loguru for logging, there arises an issue with dangling open file descriptors, specifically of shared memory files. These descriptors accumulate rapidly, posing a risk of resource exhaustion as they approach the operating system's limit. This issue is exacerbated when multiplied by the number of active threads.
Implementation Details:
The implementation utilizes a function
to instantiate the Logger class, with the option to create a new instance or reuse an existing one based on input parameters. Additionally, the method
is employed to attach handlers to the logger, with the enqueue=True parameter set to ensure thread safety and non-blocking logging operations.
Identified Issue:
The usage of enqueue=True in the add_handlers() method results in the accumulation of dangling open file descriptors, particularly for shared memory files. While intended to enhance thread safety by preventing blocking, this parameter inadvertently contributes to excessive creation of file descriptors, potentially reaching the operating system's limit.
Additional Information:
Am I missing something in the proper configuration or usage that would prevent this? Is this a know issue?
The text was updated successfully, but these errors were encountered: