Clean up temp repos when manage reset or finish-reset fails
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 72/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 0
- Forks
- 1
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 2
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de sillsdev/hgresume
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 3/5 Medio día Aptitud para principiantes 45/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 50/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de sillsdev/hgresume
Issues similares
-
Add dependency list in documentsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 3 días
-
Add 'upm' tag on githubAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
bug mac アプリ: コード アプリ: チャット 優先: 中 要トリアージ
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
yksr-melt/Meltype#1346 · 2 comentarios ·
Los mantenedores suelen responder en 1 día