ngclient: Be better with concurrent instances
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 25/100
Direção de pesquisa
Comece lendo o fluxo de Updater do ngclient, especialmente refresh(), get_targetinfo() e download_target(), e rastreie onde os metadados e os arquivos target são lidos ou gravados no cache local. Defina e documente uma política de concorrência entre processos para a criação de locks, a espera, locks obsoletos e o escopo do lock; a issue estará concluída quando essas questões em aberto tiverem um caminho de implementação acordado.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Python
- Estrelas
- 1.7k
- Forks
- 304
- Merge médio
- 9h 25min
- PRs com merge (30d)
- 14
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de theupdateframework/python-tuf
-
switch to main branch?Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
theupdateframework/python-tuf#3001 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 42/100
theupdateframework/python-tuf#2979 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Use Immutable ReleasesAbertaenhancement github_actions
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
theupdateframework/python-tuf#2920 · 1 comentário · 2 reações ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
theupdateframework/python-tuf#2842 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
theupdateframework/python-tuf#2676 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
Todas as issues de theupdateframework/python-tuf
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
Mantenedores costumam responder em até 1 dia
-
https://search.utilibre.orgAbertainstance instance add
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
searxng/searx-instances#941 · 1 comentário ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
FluidNumerics/fluid-walk-blocker#89 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia