ScopedBoo reaches maximum (255) open files

Number:rdar://26191764 Date Originated:10-May-2016 10:16 AM
Status:Open Resolved:
Product:OS X Product Version:10.11.4 (15E65)
Classification:Serious Reproducible:Always
When using document scoped bookmarks, the ScopedBoo process never closes files. After 255 open files has been reached, no more files can be opened causing document saving to fail.

Steps to Reproduce:
1. Open up a terminal window and run the following command.

while true; do lsof -c ScopedBoo; sleep 1;  done

2. Run the attached test app and hit the "Button".
3. Choose a file, then save the document.
4. Hit the "Button" again, choose another file and save the document.

Expected Results:

Actual Results:
Observe in the terminal window that ScopedBoo now has a number of open files. If you keep saving the document the number of open files in After each save, ScopedBoo's open file count continues to rise eventually reaching a count of 255. Once reached, your document to fail to save.

The only way I've found to clear the list is to reboot the machine.

With auto save enabled, users are quickly running into this problem.

The ScopedBoo process is shared between all apps so after exhausting all open files, ANY application that uses document scoped bookmarks will fail to save.

10.11.4 (15E65)

Sample app:
A document based sandboxed app with these entitlements 

App Sandbox = YES = YES = YES

Document.m code

@interface Document ()
@property (nonatomic, strong) NSData *bookmarkData;

@implementation Document

+ (BOOL)autosavesInPlace {
	return YES;

- (NSString *)windowNibName {
	return @"Document";

- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError {
	return self.bookmarkData;

- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError {
	self.bookmarkData = data;
	return YES;

- (IBAction)openFile:(id)sender {
	NSOpenPanel *panel = [NSOpenPanel openPanel];
	[panel beginSheetModalForWindow:[self windowForSheet] completionHandler:^ (NSInteger result) {
		if (result != NSFileHandlingPanelOKButton) {
		NSURL *fileURL = [[panel URLs] lastObject];
		NSData *newBookmarkData = [fileURL bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope includingResourceValuesForKeys:nil relativeToURL:self.fileURL error:nil];
		self.bookmarkData = newBookmarkData;



Reproduced with macOS 10.12 Beta (16A201w)

Apple are investigating the issue.

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!