Improper lock usage leads to inode overflow in LockLocalStorage implementation
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 931
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 4
Description
## Summary
Behaviour of [fasteners.InterProcessLock](https://github.com/harlowja/fasteners/blob/06c3f06cab4e135b8d921932019a231c180eb9f4/fasteners/process_lock.py#L114) is pretty weird: class creates a lockfile by provided path, if it doesn't exist, but not manage to remove it after lock is released.
It may lead to **uncontrolled lockfiles spam** in `/tmp` folder just because libcloud local driver is not removing [this lockfile](https://github.com/apache/libcloud/blob/trunk/libcloud/storage/drivers/local.py#L85) either.
## Detailed Information
This issue encountered in cassandra-medusa `v0.15` and lower, which was using `apache-libcloud<3.4.0,>=3.3.0` as a dependency.
Please see https://github.com/thelastpickle/cassandra-medusa/issues/528 for more details.
---
Seems like the lightweight fix is to run
```python
with contextlib.suppress(FileNotFoundError):
os.remove(filename)
```
just right in the [exit method](https://github.com/apache/libcloud/blob/trunk/libcloud/storage/drivers/local.py#L114).
Contributor guide
Research direction
Start in libcloud/storage/drivers/local.py at the local driver’s exit method and review how the lock filename is handled after InterProcessLock releases it. Confirm the behavior with a focused test or reproduction, then verify that released lockfiles are no longer left behind in /tmp without affecting missing-file cleanup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100