Asset bundle commit is a non-atomic remove-then-copy
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 ios/Sources/GutenbergKit/Sources/Model/EditorAssetBundle.swift:217-223 开始,追踪从 EditorAssetLibrary.swift:245 出发的存储路径。查看 EditorViewController.swift:223 和 EditorService.swift:234-243,以了解独立 writer 和 warm-cache 快捷路径。更新 commit 流程,使并发的 bundle commit 不会暴露缺失的目录,然后验证 EditorAssetBundleProvider.swift:78-85 中的 provider fallback 仍按预期工作。
由索引模型根据 Issue 内容生成。
描述
EditorAssetBundle.copy(to:) commits a downloaded asset bundle by deleting the destination and copying into it. Two editors on the same site can run that concurrently, so one can delete the directory the other is currently serving assets from.
Detail
ios/Sources/GutenbergKit/Sources/Model/EditorAssetBundle.swift:217-223 is directoryExists → removeItem → createDirectory → copyItem, against storageRoot/<manifest-checksum> (EditorAssetLibrary.swift:245).
Nothing serializes two writers. Each EditorViewController builds its own EditorService (EditorViewController.swift:223), which builds its own EditorAssetLibrary — actor isolation is per-instance, so two editors for the same site are two independent actors writing the same path.
How it bites
Cold asset cache (first open of a site, or after deleteAllData), slow connection. The user opens the editor, backs out, and immediately reopens.
Editor B downloads and commits, then starts serving assets from storageRoot/<checksum>. Editor A — still finishing its own download — reaches copy(to:), sees the directory exists, removes it, and re-copies. For the duration of that window every plugin/theme asset request misses the bundle.
The blast radius is smaller than it first looks, and worth stating so nobody over-fixes it:
- The path is checksum-keyed, so identical checksum means identical content. This is a window of absence, not corruption.
EditorAssetBundleProvider.swift:78-85already falls back tofetchFromRemotefor any asset missing from the bundle, so the visible editor degrades to network refetches rather than erroring. Offline, those assets just don't load.prepareAssetBundle()short-circuits onreadAssetBundles().first(EditorService.swift:234-243), so a warm cache never reachescopy(to:)at all.
Suggested fix
Commit via an atomic rename — write to a sibling temp directory and replaceItemAt — or skip the copy entirely when hasBundle(forManifestChecksum:) is already true.
Found while reviewing #651. Pre-existing; the removal of the mid-load cancellation widens the window slightly, but the old cancellation was worse here (see #667).
- 主要语言
- JavaScript
- 星标
- 29
- 派生
- 7
- 平均合并
- 2 天 2 小时
- 30 天内合并 PR
- 73
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wordpress-mobile/GutenbergKit 的其他 Issue
-
[Type] Bug [Type] Code Quality iOS
难度 2/5 1-3 小时 新手友好度 88/100
wordpress-mobile/GutenbergKit#668 ·
维护者通常 1 天内回复
-
[Type] Bug [Type] Performance iOS
难度 2/5 1-3 小时 新手友好度 88/100
wordpress-mobile/GutenbergKit#666 ·
维护者通常 1 天内回复
-
[Type] Bug iOS
难度 2/5 1-3 小时 新手友好度 78/100
wordpress-mobile/GutenbergKit#664 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
wordpress-mobile/GutenbergKit#522 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
wordpress-mobile/GutenbergKit#443 ·
维护者通常 1 天内回复
查看 wordpress-mobile/GutenbergKit 的全部 Issue
相似的 Issue
-
admission-deferred priority: medium status: ready work-class: scoped
难度 2/5 1-3 小时 新手友好度 70/100
melodic-software/claude-code-plugins#10887 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
-
难度 1/5 1-3 小时 新手友好度 91/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
enhancement ui-dashboard
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复