Clean up temp repos when manage reset or finish-reset fails
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C#
- スター
- 0
- フォーク
- 1
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sillsdev/hgresume のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 3/5 半日 初心者へのやさしさ 45/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 50/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
sillsdev/hgresume の issue をすべて見る
似ている issue
-
needs-triage
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
Azure/azure-sdk-for-net#64658 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/aspnetcore#70370 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NethermindEth/nethermind#15684 ·
メンテナーはふだん 1 日以内に返信
-
area/ai-assistant squad/flyt
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Altinn/altinn-studio#21798 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
SubtitleEdit/subtitleedit#16699 ·
メンテナーはふだん 1 日以内に返信