macOS File Provider extension crash-loops

macOS File Provider extension crash-loops with __FILEPROVIDER_OBSERVER_TOO_MANY_ITEMS__ in didDeleteItemsWithIdentifiers:, so syncing stops for good

Environment

  • SeaDrive 3.0.27 (bundle com.seafile.seadrive.fprovider, File Provider mode)

  • macOS 27.3 (build 26C5056a), Apple Silicon (Mac16,11)

  • Seafile server: 14.0.11 (Pro)

Summary

The SeaDrive File Provider extension crashes (SIGABRT) every time it enumerates changes after a lot of files were deleted on the server. Each relaunch picks up from the same sync anchor, sends the same oversized list of deletions and crashes again. From then on, no server changes reach the Mac: new files and folders never appear, and folders that already exist locally show stale content or hang when opened.

Crash stack (triggering thread, queue fpx-instance)

Exception: EXC_CRASH (SIGABRT) – Abort trap: 6
0  libsystem_kernel.dylib   __pthread_kill
1  libsystem_pthread.dylib  pthread_kill
2  libsystem_c.dylib        abort
3  libsystem_c.dylib        __assert_rtn
4  FileProvider             __FILEPROVIDER_OBSERVER_TOO_MANY_ITEMS__
5  FileProvider             -[FPXChangesObserver didDeleteItemsWithIdentifiers:]
6  SeaDrive File Provider   __69-[FileProviderEnumerator enumerateChangesForObserver:fromSyncAnchor:]_block_invoke.37
7  CoreFoundation           __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__
8  CoreFoundation           -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]
9  SeaDrive File Provider   -[FileProviderEnumerator enumerateChangesForObserver:fromSyncAnchor:]
10 FileProvider             __68-[FPXEnumerator enumerateChangesFromToken:suggestedBatchSize:reply:]_block_invoke
11 libdispatch.dylib        _dispatch_call_block_and_release
...

Analysis

In -[FileProviderEnumerator enumerateChangesForObserver:fromSyncAnchor:], the code loops over a dictionary of pending changes. For at least one entry, it passes the whole list of deleted identifiers to -[NSFileProviderChangeObserver didDeleteItemsWithIdentifiers:] in one call. The FileProvider framework limits how many items one observer call may report (see NSFileProviderChangeObserver.suggestedBatchSize). When a call goes over that limit, the framework asserts and kills the extension (__FILEPROVIDER_OBSERVER_TOO_MANY_ITEMS__).

The sync anchor is never advanced past this change set, so the problem cannot fix itself and the extension stays in a crash loop.

Suggested fix

  • Split the updated and deleted items into chunks of at most observer.suggestedBatchSize (or a safe fixed number if that property is unavailable), and send each chunk in its own didUpdateItems: or didDeleteItemsWithIdentifiers: call.

  • If more changes remain than fit in one round, call finishEnumeratingChangesUpToSyncAnchor:moreComing:YES with an intermediate anchor, and continue from that anchor in the next enumerateChangesForObserver: call. Do not report everything in one pass.

  • Consider persisting progress so that a crash in the middle of a large change set does not restart from the same point.

Steps to reproduce (expected)

  1. Use SeaDrive 3.0.27 on macOS with File Provider mode and a library already enumerated locally.

  2. On the server (web UI or another client), delete or move several thousand files from that library at once, e.g. delete a folder containing a large number of files.

  3. Wait for SeaDrive to enumerate the changes. The extension crashes, and new crash reports keep appearing in ~/Library/Logs/DiagnosticReports/SeaDrive File Provider-*.ips.

Impact

Syncing quietly stops for the whole account, with no visible error in the SeaDrive GUI. Users see missing or stale files. The only workaround is to remove the account and add it again, which resets the domain and risks losing local changes that were not uploaded yet.

Thanks for the detailed report, crash stack, and suggested approach. We will investigate the File Provider crash loop and the proposed batching and sync-anchor behavior.