fdleaky
A Python utility for detecting file descriptor leaks in Python applications. fdleaky monitors file and socket operations in your application and reports any resources that remain open longer than expected.
Upon suspicion of unclosed File Descriptors being present, hit p in the terminal to print stack traces for the point at which each file descriptor was opened.
Purpose
File descriptor leaks can be difficult to track down, especially in long-running applications. These leaks can lead to:
- Resource exhaustion
- "Too many open files" errors
- Degraded system performance
- Memory leaks
fdleaky helps you find these issues by:
- Tracking all file and socket operations
- Recording stack traces when resources are opened
- Detecting resources that remain open too long
- Reporting unclosed resources on shutdown
Installation
pip install fdleaky
Usage
Run your Python application with fdleaky monitoring:
# Run a module
python -m fdleaky your_module
# Run a Python file
python -m fdleaky your_script.py
# Run a package with __main__.py
python -m fdleaky your_package
# Run with uvicorn
poetry run python -m fdleaky uvicorn my_app:app
When a file descriptor remains open longer than the threshold (default 180 seconds), fdleaky will log:
- The type of resource (file/socket)
- The stack trace from when it was opened
- The time it has been open
Development
This project uses poetry for dependency management. To get started:
# Install dependencies
poetry install
# Run tests
poetry run pytest
How it Works
fdleaky works by:
- Patching built-in file and socket operations
- Tracking all open file descriptors
- Monitoring for resources that remain open too long
- Providing stack traces to help identify the source of leaks
Metadata
Release files for fdleaky 0.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fdleaky-0.0.11.tar.gz | 4.7 kB | Without provenance | Details for fdleaky-0.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fdleaky-0.0.11-py3-none-any.whl | Python 3 | none | any | Details for fdleaky-0.0.11-py3-none-any.whl |
Total release size: 11.4 kB
Release files / fdleaky-0.0.11.tar.gz
| Download URL | fdleaky-0.0.11.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6209aa01880e37fff1bcf788d8075133c5f6aca8080136911cbb050281886f3
|
|
BLAKE2b-256 checksum How to use checksums |
604c3924cda2b74525ce775aab23cfd4062b064a005278dceec4f8e0c7032bd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Linux/6.8.0-1021-azure
|
Release files / fdleaky-0.0.11-py3-none-any.whl
| Download URL | fdleaky-0.0.11-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd36c41f226a549aadf16350586e48be70cf214e6e7da3ec0623b101ab9a5010
|
|
BLAKE2b-256 checksum How to use checksums |
a4398218091830ce729edc12c0ac3fce94904b2ef45650545ef161695ca824ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Linux/6.8.0-1021-azure
|
Security for fdleaky 0.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.