8000 Spotlight indexing causes additional events on macOS · Issue #15 · fsnotify/fsnotify · GitHub
[go: up one dir, main page]

Skip to content
Spotlight indexing causes additional events on macOS #15
@nathany

Description

@nathany

@paulhammond reported this issue at howeyc/fsnotify#62

A temporary workaround is to add your folder(s) to the Spotlight Privacy settings.

It looks like the extra update update is being caused by mds (the daemon responsible for updating the file metadata used by spotlight). See lines 6 onwards from the output of fs_usage, which shows the name of any process performing file operations:

$ sudo fs_usage | grep TestFsnotifyAttrib.testfile
11:46:35  open              _test/TestFsnotifyAttrib.testfile                                                0.000065   fsnotify.tes
11:46:35  lstat64           _test/TestFsnotifyAttrib.testfile                                                0.000010   fsnotify.tes
11:46:35  open              _test/TestFsnotifyAttrib.testf
68B9
ile                                                0.000009   fsnotify.tes
11:46:35  chmod             _test/TestFsnotifyAttrib.testfile                                                0.000024   fsnotify.tes
11:46:35  access            /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000008   dbfseventsd 
11:46:35  getattrlist       /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000192   mds         
11:46:35  lstat64           /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000018   mdworker    
11:46:35  stat64            /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000013   mdworker    
11:46:35  lstat64           /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000009   mdworker    
11:46:35  getattrlist       /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000116   mdworker    
11:46:35  open              /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000024   mdworker    
11:46:35  getattrlist       /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000041   mdworker    
11:46:35  getattrlist       /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000116   mdworker    
11:46:35  getattrlist       go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile/.DS_Store    0.000009   mdworker    
11:46:35  getattrlist       go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile/.DS_Store    0.000006   mdworker    
11:46:35  getattrlist       go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile/.DS_Store    0.000005   mdworker    
11:46:35  getattrlist       go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile/.DS_Store    0.000005   mdworker    
11:46:35  getattrlist       /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000024   mds         
11:46:35  getattrlist       /Users/ph/go/src/github.com/howeyc/fsnotify/_test/TestFsnotifyAttrib.testfile    0.000010   mds         
11:46:35  unlink            _test/TestFsnotifyAttrib.testfile                                                0.000131   fsnotify.tes

(It's also worth noting that this test case consistently passes as of 2c4a662, because mds ignores temporary directories. But the problem is still there.)

I tried implementing throttling but found it ineffective. Spotlight will sometimes touch several files, whereas the throttling was for multiple events on the same file. At the time I tried this, NOTE_ATTRIB would trigger Write events, so it may be worth another shot (as of a100b1a).

Hopefully Spotlight will behave better with FSEvents #11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0