apache / apache/libcloud

Improper lock usage leads to inode overflow in LockLocalStorage implementation

オープン
#1,975 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
2.1k
フォーク
931
平均マージ
1日 2時間
マージ済み PR(30日)
4

説明

## 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).

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

libcloud/storage/drivers/local.py のローカルドライバーの exit メソッドから始め、InterProcessLock がロックを解放した後にロックファイル名がどのように扱われるかを確認してください。焦点を絞ったテストまたは再現で動作を確認し、その後、解放されたロックファイルが /tmp に残らなくなっていることを、存在しないファイルのクリーンアップに影響を与えずに検証してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cloud
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。