Clean up temp repos when manage reset or finish-reset fails
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 72/100
Direzione di ricerca
Start with the reset and FinishReset handlers in the manage API, along with GetTempRepoPath, InitRepoAt, SoftDeleteRepo, CleanupRepoFolder and DeleteRepoIfExists, which the issue names. Check whether the repo exists before InitRepoAt runs in reset, and wrap the temp-directory work in FinishReset so a failure deletes _____temp_____/{code}__upload__{ts}. Done means both failure paths leave no temp directory behind and the 404 and error responses are unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Two manage operations leave a directory behind in _____temp_____ when they fail partway through.
1. POST /api/manage/repos/{code}/reset on a repo that doesn't exist
var tmpRepo = new DirectoryInfo(GetTempRepoPath(code, "reset"));
await InitRepoAt(tmpRepo, cancellationToken); // creates _____temp_____/{code}__reset__{ts}
await SoftDeleteRepo(code, ResetSoftDeleteSuffix(...)); // throws DirectoryNotFoundException -> 404
tmpRepo.MoveTo(PrefixRepoFilePath(code)); // never reached
The caller gets a 404, but the freshly initialised temp repo is never cleaned up.
2. POST /api/manage/repos/{code}/finish-reset with a corrupt or invalid zip
FinishReset creates _____temp_____/{code}__upload__{ts} and then extracts into it. If ExtractToDirectory throws (bad zip, InvalidDataException, IO error, cancellation), the partially extracted directory stays behind. Only the "no .hg folder" path deletes it. The same is true for exceptions thrown later in the method, for example from CleanupRepoFolder or DeleteRepoIfExists.
Nothing cleans up _____temp_____, so these accumulate on the volume (a failed upload can be large).
Suggested fix: wrap both in try/catch (or finally with a success flag) that deletes the temp directory on failure. For reset, check that the repo exists before running InitRepoAt.
Note: this logic is a port of LexBox's HgService, which has the same behaviour today, so LexBox will keep this behaviour when it switches to /api/manage unless it's fixed here.
- Lingua principale
- C#
- Stelle
- 0
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sillsdev/hgresume
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 45/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 50/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di sillsdev/hgresume
Issue simili
-
[Bug] Dashboard renders attachment links that resolve to 404 when the FILES binding is absentApertabug 優先: 低
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
.NET area: storage bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Larson-Logan/medal-sync#61 ·
I maintainer di solito rispondono entro 1 giorno
-
area-ai bug untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
dotnet/extensions#7893 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100