Skip to content

Filesystem watching (kqueue) is enabled … with a lot of files #9183

Closed

Description

@lapo-luchini

Running: v1.25.0, FreeBSD (64-bit Intel/AMD)
Browser: Chrome 119.0.6045.33 (Official Build) beta (64-bit)

I see the "usual" warning, but on folders with very little files:

2023-10-25 09:23:57: Filesystem watching (kqueue) is enabled on "Default Folder" (default) with a lot of files/directories, and that requires a lot of resources and might slow down your system significantly
2023-10-25 09:23:57: Filesystem watching (kqueue) is enabled on "Documenti privati" (lapo-documenti) with a lot of files/directories, and that requires a lot of resources and might slow down your system significantly

image image

(this is a similar bug to #7855 (comment))

I'm running on -verbose but I see nothing strange… what shouldI look for? How else can I help debug?

Activity

  1. added
    bug
    needs-triage
    on Oct 25, 2023
  2. calmh commented on Oct 25, 2023

    @calmh
    Member

    If you're running with -verbose you should get an occasional line with Summary for folder ... (at least, when something has changed in the folder and you have the GUI up). That line contains the numbers that are the basis for triggering the warning in question, so would be interesting to see.

    [I6KAH] 2023/10/25 11:03:02 VERBOSE: Summary for folder "default" is &{Errors:0 PullErrors:0 Invalid: GlobalFiles:8078 GlobalDirectories:9538 GlobalSymlinks:0 GlobalDeleted:0 GlobalBytes:8443669097 GlobalTotalItems:17616 LocalFiles:8078 LocalDirectories:9538 LocalSymlinks:0 LocalDeleted:0 LocalBytes:8443669097 LocalTotalItems:17616 NeedFiles:0 NeedDirectories:0 NeedSymlinks:0 NeedDeletes:0 NeedBytes:0 NeedTotalItems:0 ReceiveOnlyChangedFiles:0 ReceiveOnlyChangedDirectories:0 ReceiveOnlyChangedSymlinks:0 ReceiveOnlyChangedDeletes:0 ReceiveOnlyChangedBytes:0 ReceiveOnlyTotalItems:0 InSyncFiles:8078 InSyncBytes:8443669097 State:scanning 11:02:42 +0200 CEST Error: Version:17616 Sequence:17616 WatchError:}
    
  3. lapo-luchini commented on Dec 12, 2023

    @lapo-luchini
    Author

    Those two shares gave the following summary:

    Summary for folder "default" is &{Errors:0 PullErrors:0 Invalid: GlobalFiles:3 GlobalDirectories:0 GlobalSymlinks:0 GlobalDeleted:0 GlobalBytes:21 GlobalTotalItems:3 LocalFiles:3 LocalDirectories:0 LocalSymlinks:0 LocalDeleted:0 LocalBytes:21 LocalTotalItems:3 NeedFiles:0 NeedDirectories:0 NeedSymlinks:0 NeedDeletes:0 NeedBytes:0 NeedTotalItems:0 ReceiveOnlyChangedFiles:0 ReceiveOnlyChangedDirectories:0 ReceiveOnlyChangedSymlinks:0 ReceiveOnlyChangedDeletes:0 ReceiveOnlyChangedBytes:0 ReceiveOnlyTotalItems:0 InSyncFiles:3 InSyncBytes:21 State:idle 15:43:19 +0100 CET Error: Version:10 Sequence:10 WatchError:}
    Summary for folder "lapo-documenti" is &{Errors:0 PullErrors:0 Invalid: GlobalFiles:54 GlobalDirectories:8 GlobalSymlinks:0 GlobalDeleted:1 GlobalBytes:27881826 GlobalTotalItems:63 LocalFiles:54 LocalDirectories:8 LocalSymlinks:0 LocalDeleted:1 LocalBytes:27881826 LocalTotalItems:63 NeedFiles:0 NeedDirectories:0 NeedSymlinks:0 NeedDeletes:0 NeedBytes:0 NeedTotalItems:0 ReceiveOnlyChangedFiles:0 ReceiveOnlyChangedDirectories:0 ReceiveOnlyChangedSymlinks:0 ReceiveOnlyChangedDeletes:0 ReceiveOnlyChangedBytes:0 ReceiveOnlyTotalItems:0 InSyncFiles:54 InSyncBytes:27881826 State:idle 15:43:19 +0100 CET Error: Version:75 Sequence:75 WatchError:}
    
  4. calmh commented on Dec 12, 2023

    @calmh
    Member

    Fascinating. I have no idea how that could trigger the warning. I mean, the code is here:

    syncthing/lib/model/folder.go

    Lines 1068 to 1073 in 935a28c

    } else if data.Summary.LocalTotalItems-data.Summary.LocalDeleted > kqueueItemCountThreshold {
    f.warnedKqueue = true
    summarySub.Unsubscribe()
    summaryChan = nil
    l.Warnf("Filesystem watching (kqueue) is enabled on %v with a lot of files/directories, and that requires a lot of resources and might slow down your system significantly", f.Description())
    }

    The values are in your log lines; it's nowhere near

    // Arbitrary limit that triggers a warning on kqueue systems
    const kqueueItemCountThreshold = 10000

  5. lapo-luchini commented on Dec 12, 2023

    @lapo-luchini
    Author

    Thanks for the pointer… I know no Go myself, but I should be able to add some "more verbose" debug to it.

  6. lapo-luchini commented on Dec 12, 2023

    @lapo-luchini
    Author
    l.Warnf("XXX Filesystem watching, LocalTotalItems=%v LocalDeleted=%v kqueueItemCountThreshold=%v", data.Summary.LocalTotalItems, data.Summary.LocalDeleted, kqueueItemCountThreshold)

    gives this:

    2023/12/12 16:59:00 WARNING: XXX Filesystem watching, LocalTotalItems=16406 LocalDeleted=24 kqueueItemCountThreshold=10000
    2023/12/12 16:59:00 WARNING: XXX Filesystem watching, LocalTotalItems=16406 LocalDeleted=24 kqueueItemCountThreshold=10000
    

    … so I guess that's a global total, not a folder-specific total.
    (yes, I have some 10k files, in other folders with kqueue already disabled)

  7. er-pa commented on Dec 12, 2023

    @er-pa
    Member

    Interesting. I tried to reproduce it, successfully. Here it seems to be caused by the un-watched folder's periodic scan handling a change (a folder with >10k files). As soon as that happens, a summary containing >10k local files is tossed and the óther folder (only a handful files, with the watcher enabled) triggers the error.

    Seems like we don't verify if the summary actually belongs to the folder we watch it for and/or that the folder it's about actually has the watcher enabled?

  8. removed
    needs-triage
    on Dec 13, 2023
  9. added a commit that references this issue on Dec 13, 2023
    c7c93d1
  10. added a commit that references this issue on Dec 16, 2023
    64aa109
  11. added this to the v1.27.2 milestone on Dec 25, 2023
  12. added 2 commits that reference this issue on Jan 4, 2024
    db2c610
    cbead14
  13. added a commit that references this issue on Jan 28, 2024
    e8d3529
  14. added
    frozen-due-to-age
    on Apr 9, 2025
  15. locked and limited conversation to collaborators on Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions