The culprit was a large (over 3,600) number of links stored in Safari’s “Reading List” causing Safari to hit an open thread limit. The solution was to delete my entire reading list. Read on for details:
I could not reproduce the crash when launching Safari with my network connection disabled, suggesting that Safari was hanging on some kind of network request.
Looking at the crash report that I was prompted to send to Apple yielded the answer. I noticed two things in the crash report:
- An error message saying “Dispatch Thread Hard Limit: 512 reached … too many dispatch threads blocked in synchronous operations”
- Tons of open threads mentioning
Searching the web for
com.apple.network.boringssl.metrics_queue turned up this bug report for NetNewsWire.
My guess: Apple’s doing some kind of metrics report on each feed download. But, if you have 1,000 feeds (or some large number), and Apple’s metric calls are slow to complete, then you could hit that 512 limit
Thinking about what mass group of URLs Safari might be fetching in the background, I thought about Reading List. Even wiping all my Safari data in ~/Library, which I had already tried, might not prevent this, because iCloud could just re-synchronize my Reading List as soon as it had a network connection. The solution was to clear the Reading List for all my devices.
Here’s how I cleared my Reading List while maintaining a backup of my stored links. Instructions are for Safari 15.2 on macOS 10.15.7:
- Quit Safari.
- Open Finder, then choose “Go -> Go to Folder…” from the menu bar
- Type in ~/Library/Safari and click “Go”.
- Copy these files to your desktop:
Bookmarks.plist. These files contain human- and machine-friendly copies of your Safari bookmarks and Reading List links. Keep these files so that you still have a copy of your Reading List links after we delete them from Safari.
- Turn off wifi, or otherwise disable your Mac’s network connection.
- Launch Safari.
- Open Reading List.
- Switch to showing all items, both read and unread.
- Right click a Reading List item, then click “clear all”.
- Turn on wifi. This should cause Reading List to be deleted on all your devices signed into your iCloud account. (Provided they have enabled Safari synchronization in iCloud preferences.)
Note that the
AutomaticBookmarksBackup.html file does not preserve the read/unread status of the reading list links, although maybe you could find that information in the
.plist file. Or, if you don’t care about preserving already-read links, delete those first, then backup the
AutomaticBookmarksBackup.html file, then delete the rest.