Crash in Media.makeMedia(blog:) when a post is deleted while it's being saved (EXC_BREAKPOINT makeMediaWithBlog:)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- swift
- 領域
- mobile-dev
調査の方向性
Start with PostRepository.swift at _sync and update, then trace the calls through PostHelper.m and Media+Blog.swift to Media.makeMedia(blog:). Build the Jetpack scheme and follow the repro steps, including syncing the Posts list while a save is in flight. Done looks like confirming the failure and ensuring that scenario no longer crashes; post the results here and update the issue status.
索引モデルが issue の本文から書いたものです。
説明
Likely shares a root cause with #26316, #26318, #26319, #26320. See #26323: posts are deleted locally by a first-page list sync while still in use.
Sentry: JETPACK-IOS-1BN2, JETPACK-IOS-1CA4
Sentry snapshot (as of Oct 30, 2026)
Fatal EXC_BREAKPOINT (a Swift force-unwrap trap) in Media.makeMedia(blog:). It has been ongoing since June 2024: 1BN2 has 509 events from 117 users, and 1CA4 has 250 events from 81 users.
| Last 30 days | 1BN2 users | 1CA4 users |
|---|---|---|
| 27.3 | 51 | 32 |
| 27.2 | 16 | 7 |
27.3 has about 4.2× as many error-reporting users as 27.2 (2,388 vs 573), so these numbers are flat per user, not a regression. Most events are on iPhone, with some on iPad (2 of the 8 sampled 1BN2 events), almost all on iOS 26.x and 27.x. Some users crash repeatedly.
Stack
Both groups have the same crash and differ only in the caller:
- 1BN2:
PostRepository._sync(PostRepository.swift:156) →PostHelper.update(post, with: remotePost, …) - 1CA4:
PostRepository.update(PostRepository.swift:216), the quick-edit patch →PostHelper.update(...)
Both then go PostHelper.m:43 (post.featuredImage = [Media existingOrStubMediaWithMediaID:… inBlog:post.blog]) → Media.existingOrStubMediaWith (Media+Blog.swift:51) → Media.makeMedia(blog:) (Media+Blog.swift:19), which does makeMedia(in: blog.managedObjectContext!). The force-unwrap is the crash.
So it only happens when the server returns a featured image (postThumbnailID != nil) that isn't cached locally, and post.blog has no context.
Breadcrumbs (3 events sampled)
- The trigger was a save, every time. The crash comes right after a
POST …/posts/{id}?context=editreturns 200, from the editor (EditPostViewController→GutenbergViewController, closed with Close), fromPublishPostViewController, or from a post-list context-menu action. - Usually after returning to the app (2 of 3). The app came back to the foreground minutes to hours later, and the Posts list re-synced (
status=draft,pendingorpublish,private) while the request was in flight. - Images uploaded first (1 of 3). In one event, images were added through
PHPickerViewControllerand uploaded just before the save.
Candidate code (hypothesis)
- The post is deleted during the network
await._syncandupdatereadpostagain on the main context afterawait _patch(...)orawait _create(...). If a Posts list sync, a trash or a blog removal deletes the post during that await,post.blogreturns nil for the deleted object,blog.managedObjectContextis nil, and the force-unwrap traps. - No guard.
PostRepositorynever checkspost.isDeletedorpost.managedObjectContextafter the await. - Same cause as #26318. That crash is in
_createbefore the request is even sent:post.blogis nil there too.
Fix direction:
- After each await in
_syncandupdate, return early (or throw) ifpost.managedObjectContext == nil || post.isDeleted. - Make
makeMedia(blog:)fail softly instead of force-unwrapping.
Repro to try
- Turn on Network Link Conditioner on the host (3G, or 2+ s latency) so save requests take a while.
- On a WordPress.com site, open a published post that has a featured image, then make sure that image isn't in the app's Media cache: sign in fresh or relaunch with
-ui-test-reset-everything, and don't open Media. - Edit the post and tap Update. While the request is in flight, delete the post locally:
- pull to refresh the Posts list after trashing the post on the web, or
- trash it from the list's context menu.
- Also try the quick-edit path (1CA4): change the post's status or visibility from the list's context menu, then trigger a list sync before it finishes.
- Pass: the crash in
Media.makeMedia(blog:), or confirmation in the debugger thatpost.isDeletedis true after the await.
Events
63ff7b65a49046b3b6e8a128bee10bd2(1BN2)b6ca8271b3b040ec8f1e65fb70d0ebef(1BN2, iPad)14391744a1f14fe79741894f60ab19a5(1BN2)1fca673390b34f64bd0f7f7dd629c48c(1CA4)bf5edd9208ae4c5cad1db96e29fead2b(1CA4)
Build the Jetpack scheme and sign in using docs/simulator-sign-in.md, with bundle ID com.automattic.jetpack.
When you're done: post the results here. If you now have reliable steps, remove [Status] Needs Repro. If you found the cause and a fix approach, remove [Status] Needs Plan and add [Status] Ready for Dev. Remove Simulator Testable when you're finished.
Generated by Claude Code
- 主要言語
- Swift
- スター
- 3.9k
- フォーク
- 1.2k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 136
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wordpress-mobile/WordPress-iOS のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
wordpress-mobile/WordPress-iOS#26423 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wordpress-mobile/WordPress-iOS#26279 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
wordpress-mobile/WordPress-iOS#26276 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
wordpress-mobile/WordPress-iOS#26256 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Status] Ready for Dev [Type] Bug Reader
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
wordpress-mobile/WordPress-iOS#26254 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
wordpress-mobile/WordPress-iOS の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
🎉 Add RemoteCrabオープン
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
jaywcjlove/awesome-mac#4999 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
wordpress-mobile/GutenbergKit#940 ·
メンテナーはふだん 1 日以内に返信
-
pending-maintainer-response pending-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws-amplify/amplify-swift#4423 ·
メンテナーはふだん 2 日以内に返信
-
tests
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
erkamyaman/unslop-anything#80 ·
メンテナーはふだん 1 日以内に返信