mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #1660] iOS app crashes when clearing notifications (mutation during enumeration) #1157
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#1157
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jflammia on GitHub (Mar 17, 2026).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1660
Bug Description
The ntfy iOS app crashes with
SIGABRTwhen attempting to clear/delete all notifications for a subscription. The app becomes unusable once enough notifications accumulate (~870 in my case) because the only recovery is to delete and reinstall the app.Crash Analysis
Exception:
EXC_CRASH/SIGABRT(Abort trap: 6)Device: iPhone 15 Pro (iPhone16,1), iOS 26.3.1
App Version: 1.3 (build 4)
Root Cause
The crash occurs in
Store.swiftatdelete(allNotificationsFor:)(line ~151 in ntfy-ios repo):The
forEachloop callscontext.delete()on each notification while iterating oversubscription.notifications(anNSSet). Core Data's_processRecentChanges:fires on the run loop observer during this iteration and tries to enumerate the same collection, causing a mutation-during-enumeration crash.Stack Trace
Main thread (triggered):
Last exception backtrace:
Background SQLite thread was inside
_prefetchObjectsForDeletePropagationat crash time, confirming Core Data was processing the deletes concurrently.Suggested Fix
Option A — Copy before iterating (minimal fix):
Option B — NSBatchDeleteRequest (better for large datasets):
Option B is preferred as it doesn't load objects into memory and handles any number of notifications efficiently.
The same pattern should also be applied to
delete(notifications:)which has the same mutation-during-enumeration vulnerability.Steps to Reproduce
Environment
Workaround
Delete and reinstall the ntfy iOS app to clear the local Core Data database.
@RezzZ commented on GitHub (Mar 20, 2026):
app crashes for me too, but messages do get deleted and a restart of the app works for me. so no workaround required here