ngclient: Be better with concurrent instances
Maintainer thường phản hồi trong vòng 10 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc luồng Updater của ngclient, đặc biệt là refresh(), get_targetinfo() và download_target(), đồng thời theo dõi nơi metadata và các tệp target được đọc hoặc ghi trong cache cục bộ. Xác định và ghi lại chính sách đồng thời giữa các tiến trình cho việc tạo lock, chờ, các lock cũ và phạm vi của lock; issue được hoàn thành khi các câu hỏi còn bỏ ngỏ đó có một hướng triển khai đã được thống nhất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 1.7k
- Fork
- 304
- Merge trung bình
- 9 giờ 25 phút
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của theupdateframework/python-tuf
-
switch to main branch?Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
theupdateframework/python-tuf#3001 ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
theupdateframework/python-tuf#2979 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Use Immutable ReleasesĐang mởenhancement github_actions
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
theupdateframework/python-tuf#2920 · 1 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Investigate/test fetcher retriesĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
theupdateframework/python-tuf#2842 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
theupdateframework/python-tuf#2676 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 10 ngày
Tất cả issue của theupdateframework/python-tuf
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
solana-foundation/pay-kit#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nasa/python_cmr#123 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
EleutherAI/lm-evaluation-harness#4243 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: dashboard bug perceived difficulty: 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
cusp-ai-oss/tojax#17 ·