Safari Content Blocker fails to reload with large amount of rules (but under limit)

Hello,

I am developing Safari Content Blocker extension and discovered that it frequently fails to load with large amount of rules. Currently I have over 45k and most of the time when I reload the extension on iOS 18 (iPhone 12) it ends with error:

Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.SafariServices.ContentBlockerLoader" UserInfo={NSDebugDescription=connection to service named com.apple.SafariServices.ContentBlockerLoader} #0

And the simpler message is just:

Couldn’t communicate with a helper application.

From what I managed to find (for example here - https://developer.apple.com/forums/thread/756931) the limit for blocking rules should be 150k items.

It was previously 50k but got increased years ago.

Is there anything special I need to do to get the extension to work reliably with say 100k items?

I am usng the JSON format from the docs:

    {
        "trigger": {
            ...
        },
        "action": {
            ...
        }
    },
    {
        "trigger": {
            ...
        },
        "action": {
            ...
        }
    }
]

My trigger is url-filter and the action is type: block

I was thinking about providing multiple JSON files in attachments property of NSExtensionItem but apparently that is not supported.

Thanks for help!

Answered by DTS Engineer in 824262022

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a copy of the extension that does not load with some directions for reproducing the error, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a copy of the extension that does not load with some directions for reproducing the error, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Thanks! Just submitted - FB16477099.

Safari Content Blocker fails to reload with large amount of rules (but under limit)
 
 
Q