`NSXPCConnectionInterrupted` error code when reloading Safari content blockers
Prerequisites
Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- [x] I am running the latest version
- [x] I checked the documentation and found no answer
- [x] I checked to make sure that this issue has not already been filed
Issue Details
- AdGuard version: 4.4.6
- Device model and storage size: ipad mini 5
- Operating system and version: 16.4.1
- Browser or App:
Filters
- Base
- Mobile
- AdGuard Tracking Protection filter
- AdGuard social filter
- 5x AdGuard filters in
Annoyances section(not includingAdGuard Annoyances filter) - 60 URL exclusions (like
@@||example.com^)
Expected Behavior
The whole process of updating the filters should take about a minute. Crash time: 22:56
Actual Behavior
After 10 minutes of rule conversion there was a crash. The process usually takes two to three minutes.
Additional Information
Logs: AdGuard_logs.zip
Weird stuff in the logs:
2023/04/20 22:56:11:154 [2288692(com.apple.NSXPCConnection.user.com.apple.SafariServices.ContentBlockerLoader)] (ContentBlockerService) - reloadContentBlocker; Error reloading content blocker; Error: ["NSDebugDescription": connection to service named com.apple.SafariServices.ContentBlockerLoader]
2023/04/20 22:56:11:229 [2275827(SafariAdGuardSDK.SafariProtection.workingQueue)] (SafariProtection+UserRules) - modifyRule.onCbReloaded; Error reloading CBs when modifying rule=!2 to UserRule(ruleText: "!2", isEnabled: true) for type=blocklist; Error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.SafariServices.ContentBlockerLoader" UserInfo={NSDebugDescription=connection to service named com.apple.SafariServices.ContentBlockerLoader}
Error code 4097 means that NSXPCConnectionInterrupted. In this particular case this may mean that SafariServices.ContentBlockerLoader either crashed or failed to start up.
According to your log due to multiple changes to user rules multiple reload operations were triggered at the same time. Maybe they lead to simultaneous calls to that service and somehow broke it?
I've managed to more or less reliably reproduce this issue. The algorithm is a little bit "synthetic", but nevertheless.
- Add a few rules to "User rules"
- Start quickly disabling and enabling them one by one.
Each of these changes will trigger reloading of the content blockers which in turn will eventually lead the broken SafariServices.ContentBlockerLoader. Once it broke, you can restore functionality by going to iOS Settings -> Safari and disable all content blockers there and then enable them back.
I suspect that this is the same issue that sometimes happens when iOS updates.
What's interesting, after some time the situation seem to have normalized and SafariServices.ContentBlockerLoader started working again.