Commit bdbdf58
fix(DiffPipeline): CopyUnknownFiles 使用原子替换避免文件占用冲突
ISSUE: 全量包升级时,CopyUnknownFiles 直接调用 File.Copy(dest, true)
覆盖目标文件。若目标进程刚退出,文件句柄未释放,抛出 IOException:
'The process cannot access the file because it is being used by another process'
导致 AllPackagesSucceeded=false,版本号不回写 manifest,ClientTest
陷入无限循环检测-下载-失败的更新循环。
FIX: CopyUnknownFiles 改为和 ApplyPatch 一致的 temp-file 原子替换策略:
1. File.Copy 到临时文件 {random}_{filename}
2. File.Replace 原子替换目标文件
3. 新文件直接用 File.Move
File.Replace 是 NTFS 内核级原子操作,不会出现半覆盖状态。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 829c4a0 commit bdbdf58
2 files changed
Lines changed: 16 additions & 10 deletions
File tree
- src/c#/GeneralUpdate.Core/Pipeline
- tests/ClientTest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
511 | 526 | | |
512 | 527 | | |
513 | 528 | | |
| |||
This file was deleted.
0 commit comments