A simple IOC / Dependency injection micro framework for Python.
Project description
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.
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fdleaky-0.0.2.tar.gz.
File metadata
- Download URL: fdleaky-0.0.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d274d033455b75f449f9e3b4514a7f3c7fb411268546dfc0bff7add4977b2b4
|
|
| MD5 |
dfdb25c41cd8ea1649810545989213d2
|
|
| BLAKE2b-256 |
bd1fd6728aee387ffaae497dbb63575879ef82b32d6af0dfff3a7a1d79d8b2a9
|
File details
Details for the file fdleaky-0.0.2-py3-none-any.whl.
File metadata
- Download URL: fdleaky-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0774a400ffd74cfb967bd3cbb557855741d873142dfa007848eac0707b444ee2
|
|
| MD5 |
48c218ae3cc135aed7d9f97f6579ef44
|
|
| BLAKE2b-256 |
cc866c050dd4f05b32bcdcdcce13354699be80c000915f2c09aad7df1f4c52e7
|