Time Machine causes NSFileCoordinator to deadlock

Originator:graeter
Number:rdar://29986681 Date Originated:12-Jan-2017 09:14 AM
Status:Closed (Duplicate) Resolved:
Product:macOS Product Version:10.12.2
Classification: Reproducible:Always
 
Summary:
The attached sample project runs into a deadlock, as soon as TimeMachine is performing a backup.

To explain it:

- The project creates two NSFilePresenter for the file "~/Desktop/presenter-problem.txt"
- One file presenter is constantly writing a file (as coordinated write)
- The other file presenter is just waiting for changes through -presentedItemDidChange (coordinated, with NSFileCoordinatorReadingWithoutChanges)

Both file presenter implement at least one of the callback delegates (e.g. -relinquishPresentedItemToReader:).

If Time Machine is not performing backups, the sample app works: One presenter is writing, the other is reading. You'll see a progressing output on the Console.

However, if Time Machine is performing backups, the app hangs while attempting to perform a coordinated read or a coordinated write (in -updateContents and presentedItemDidChange). 

I've attached sysdiagnose logs. Please have a special look at "filecoordination-dump.txt", which shows that the subarbiter "backupd" is somehow invovled in the file lock.

Steps to Reproduce:
1. Start a Time Machine backup and wait until the actual backup starts (the Time Machine menu should show "Backing up: X of Y MB")
2. Start the sample app


Expected Results:
The sample app should show an infinite loop of write operations and read operations.

Actual Results:
Only a few write / read operations are performed. After some steps, the app stops and hangs forever in -updateContents and -presentedItemDidChange.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!