ngclient: Be better with concurrent instances
維護者通常 10 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
先閱讀 ngclient 的 Updater 流程,尤其是 refresh()、get_targetinfo() 和 download_target(),並追蹤 metadata 和 target 檔案在本機快取中的讀取或寫入位置。為跨程序鎖的建立、等待、過期鎖定和鎖定範圍定義並記錄並行策略;當這些未決問題都有達成共識的實作路徑時,該 issue 即完成。
由索引模型根據 Issue 內容生成。
描述
Users may run multiple updaters at the same time -- it's not useful but it can happen with longer dependency chains like https://github.com/sigstore/sigstore-python/issues/1403: model-signing uses sigstore-python which uses python-tuf...
Currently we don't handle the potential conflicts WRT reading and writing metadata and target files to local cache that result from concurrent updaters. This is especially an issue with windows where concurrent file access leads to issues more often but it can be problematic in linux too -- this is why currently we just document Updater as "should be a singleton".
Possible improvement: lockfile
I think it makes sense to not try to solve this for just a single process but multiple real processes running updaters (something I can easily imagine happening in real life). In that case I think a lock file per repository would be best we can do:
- check for lock file before reading/writing
- create lock file, read/write, remove lock file
The reason this hasn't been done is that lockfiles are a pain to do especially cross platform.
Some open questions:
- what to do when a lock file exists -- log a warning and wait (for how long?)? I don't usually like when libraries wait for things but maybe this works? What if the lock file is stale (let's say hours old)?
- manually handling lockfiles in a way that works on windows is painful... but we've also done a lot of work to avoid unnecessary dependencies in this project. Using a dependency for this is likely the smaller evil
- when exactly do we lock?
- locking for lifetime of Updater probably has annoying side effects and is not expected by users
- locking for duration of
refresh()andget_targetinfo()seems logical at least at first glance. Locking for duration ofdownload_target()is probably less important but could be done
Possible improvement: global state
If we are not interested in multiple processes but just multiple threads with updaters, we could always add some global state tracking... It sounds quite unappealing but possible. I feel like I'd rather advice python-tuf users to use ngclient Updater as a "per-repository-singleton"?
CC @spencerschrock, let me know if you have thoughts
- 主要語言
- Python
- 星號
- 1.7k
- 分支
- 304
- 平均合併
- 9 小時 25 分鐘
- 30 天內合併 PR
- 14
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
theupdateframework/python-tuf 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 48/100
theupdateframework/python-tuf#3001 ·
維護者通常 10 天內回覆
-
難度 4/5 3-5 天 新手友好度 42/100
theupdateframework/python-tuf#2979 · 1 則留言 ·
維護者通常 10 天內回覆
-
enhancement github_actions
難度 3/5 1-2 天 新手友好度 45/100
theupdateframework/python-tuf#2920 · 1 則留言 · 2 個 reaction ·
維護者通常 10 天內回覆
-
難度 3/5 1-2 天 新手友好度 35/100
theupdateframework/python-tuf#2842 · 3 則留言 ·
維護者通常 10 天內回覆
-
難度 5/5 一週以上 新手友好度 30/100
theupdateframework/python-tuf#2676 · 2 則留言 · 1 個 reaction ·
維護者通常 10 天內回覆
查看 theupdateframework/python-tuf 的全部 Issue
相似的 Issue
-
bug status/needs-triage
難度 2/5 1-3 小時 新手友好度 86/100
prowler-cloud/prowler#12887 · 1 則留言 ·
維護者通常 1 天內回覆
-
area: desktop platform: macos priority: p3 status: ready type: enhancement
難度 1/5 1 小時以內 新手友好度 92/100
use-agent-os/agent-os#3484 ·
維護者通常 2 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 86/100
open-telemetry/opentelemetry-python-contrib#5113 · 2 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
external
難度 2/5 1-3 小時 新手友好度 68/100
langchain-ai/docs#6255 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆