Crash in Media.makeMedia(blog:) when a post is deleted while it's being saved (EXC_BREAKPOINT makeMediaWithBlog:)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- swift
- Área
- mobile-dev
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Swift
- Estrellas
- 3.9k
- Forks
- 1.2k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 136
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de wordpress-mobile/WordPress-iOS
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
wordpress-mobile/WordPress-iOS#26423 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
wordpress-mobile/WordPress-iOS#26276 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
wordpress-mobile/WordPress-iOS#26256 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Status] Ready for Dev [Type] Bug Reader
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
wordpress-mobile/WordPress-iOS#26254 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de wordpress-mobile/WordPress-iOS
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
🎉 Add RemoteCrabAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
jaywcjlove/awesome-mac#4999 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
wordpress-mobile/GutenbergKit#940 ·
Los mantenedores suelen responder en 1 día
-
pending-maintainer-response pending-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
aws-amplify/amplify-swift#4423 ·
Los mantenedores suelen responder en 2 días
-
tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
erkamyaman/unslop-anything#80 ·
Los mantenedores suelen responder en 1 día