Crash in Blog.xmlrpcApi when saving a post that was deleted locally (EXC_BAD_ACCESS at 0x48, since 27.2)

オープン
#26,318 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
ios, swift
領域
databases, mobile

調査の方向性

Start with PostRepository.swift (_sync, _create, and getRemoteService) and trace how a deleted post reaches Blog.swift's xmlrpcApi getter, checking the related PostServiceRemoteFactory.swift call. Build the Jetpack scheme and follow the reproduction steps using docs/simulator-sign-in.md; done means reporting whether the crash reproduces and, if confirmed, what the investigation establishes about the deleted post and blog.

索引モデルが issue の本文から書いたものです。

説明

[Status] Needs Plan [Status] Needs Repro [Type] Crash Core Data Posts + Pages

Likely shares a root cause with #26316, #26317, #26319, #26320. See #26323: posts are deleted locally by a first-page list sync while still in use.

Sentry: JETPACK-IOS-1KJC

Sentry snapshot (as of Oct 30, 2026)

Fatal EXC_BAD_ACCESS: KERN_INVALID_ADDRESS at 0x48. It was first seen Aug 31, 2026, the 27.2 release; Sentry's suspect commit is the release/27.2 merge (#25916). Totals: 114 events from 79 users.

Last 30 days Events Users
27.3 62 41
27.2 7 7

27.3 has about 4.2× as many error-reporting users as 27.2, so 41 against 7 (about 5.9×) is slightly rising. All events are on iPhone, on iOS 26.5 to 27.2. Some users crash repeatedly.

Stack

PostRepository._create (PostRepository.swift:222) → getRemoteService(for: post.blog) (:393) → PostServiceRemoteFactory.forBlog (PostServiceRemoteFactory.swift:14) → Blog.xmlrpcApi.getter (Blog.swift:81) → URL? → crash.

Blog.swift:81 is if _xmlrpcApiEndpoint != endpoint, which reads a Swift stored property. Reading address 0x48 means self is nil: that's a field offset from a nil pointer.

Why it started in 27.2 (hypothesis)
  • The 27.2 change. #25869 (in 27.2) added the _xmlrpcApiEndpoint cache, a Swift stored property read inside the xmlrpcApi getter.
  • How a nil blog reaches it. post.blog is declared non-optional (@NSManaged public var blog: Blog), but Core Data returns nil for it when the post has been deleted. Objective-C calls on a nil blog, like supports(.wpComRESTAPI) and wordPressComRestApi, silently return NO/nil, so forBlog falls through to blog.xmlrpcApi.
  • Before and after. Before 27.2, that getter didn't touch Swift storage, so a nil blog probably came back as nil and PostRepository threw remoteAPIUnavailable. Now it crashes.
  • Why it's _create. A deleted post also reads postID as nil, so _sync takes the create path.
Breadcrumbs (3 events sampled)

Every time, the crash comes right after the user commits a change to a post they opened earlier:

  • Editor → Close → alert → Update (publishButtonTapped)
  • Post Settings opened from Posts search → Cancel → alert → Done
  • Posts search → editor → Close → Move to Trash alert
  • In all three the app went to the background and came back while the post was open, and Posts list syncs ran in between.
  • Two of the three started from Posts search (status=any,trash results).
Candidate code (hypothesis)
  • Same cause as #26317. The post was deleted locally, by a list sync or a trash, while the editor or Post Settings still held it.
  • Fix direction:
    • In PostRepository._sync, _create and getRemoteService, guard post.managedObjectContext != nil && !post.isDeleted.
    • Make forBlog and xmlrpcApi safe against a deleted or nil blog.
Repro to try
  1. Sign in to a self-hosted site with an application password, or to any site where forBlog reaches xmlrpcApi. Use a site with several published posts.
  2. Posts → Search → open a result in the editor, or in Post Settings.
  3. Delete the post locally while it's open: trash it on the web and pull to refresh the Posts list, or background the app long enough for a list sync to purge it.
  4. Tap Update, or Done in Post Settings.
  5. Pass: EXC_BAD_ACCESS in Blog.xmlrpcApi, or a breakpoint in _create showing post.isDeleted == true and post.blog == nil.
Events
  • af200e41c91a4ffe86ff64f393dd5d25
  • dd1b9b7460a84a048da50d1f7e64d6bc
  • c1ac90b2a8de4ec3bed82e4261ace77f
  • 223ecf228a864eaa9a6510c29461b7d3
  • bf039188011e41eaac00138c1d995844

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

wordpress-mobile/WordPress-iOS のほかの issue

wordpress-mobile/WordPress-iOS の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。