Skip to content

very slow scanning when there are many content-identical files  #10777

Closed

Description

@iyanmv

What happened?

Since two or three releases ago (don't know exactly when this changed, but probably v2.1.0) scanning is terribly slow. In the past, scanning would take a few seconds (way less than a minute). Now on both my PC and laptop this process can take way over 10 minutes. At least one time, the laptop was scanning for hours.

Image

Syncthing version

2.1.1

Platform & operating system

Linux x86-64 (Arch Linux)

Browser version

No response

Relevant log output

Let me know what logs would be useful to debug this.

Activity

  1. added
    bug
    needs-triage
    on Jul 1, 2026
  2. added theissue type on Jul 1, 2026
  3. iyanmv commented on Jul 1, 2026

    @iyanmv
    Author

    After changing Logs -> Debugging Facilities -> File change detection and hashing (scanner) to Debug, it seems like the current scanner is going very slowly over directories with .git folders.

    (snip)
    Jul 01 19:21:42 ilum syncthing[1415]: walker/2rjpi-uewi7@0xcd9134f91e0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/1451588/notree/9a931da8a0b39ff27f033ea6b8f863c7bfca71bd (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Jul 01 19:21:42 ilum syncthing[1415]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/1451588/notree/b8b6f1c8e2a637ef5ab9ef2e289d1ff255dc1cb6", Sequence:0, Permissions:0644, ModTime:2026-07-01 19:10:45.204682576 +0200 CEST, Version:{[{ENURVPV 1782925864}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Jul 01 19:21:44 ilum syncthing[1415]: walker/2rjpi-uewi7@0xcd9134f91e0: Walk 2rjpi-uewi7 [ArchLinux/PKGBUILDs/.git/objects/a2/192d51a748abd996fc5ede38f022da61533ba4 ArchLinux/PKGBUILDs/.git/objects/d4/aff4e1e2d252bb1b0a7612e2fcf0ed34e62c08 ArchLinux/PKGBUILDs/.git/objects/pack/pack-8672532484142e0f5f6b071197821b9134bdf541.pack ArchLinux/PKGBUILDs/.git/subtree-cache/1451588] current progress 187661/208505 at 0.0 MiB/s (90%) (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=183)
    Jul 01 19:21:46 ilum syncthing[1415]: walker/2rjpi-uewi7@0xcd9134f91e0: Walk 2rjpi-uewi7 [ArchLinux/PKGBUILDs/.git/objects/a2/192d51a748abd996fc5ede38f022da61533ba4 ArchLinux/PKGBUILDs/.git/objects/d4/aff4e1e2d252bb1b0a7612e2fcf0ed34e62c08 ArchLinux/PKGBUILDs/.git/objects/pack/pack-8672532484142e0f5f6b071197821b9134bdf541.pack ArchLinux/PKGBUILDs/.git/subtree-cache/1451588] current progress 187661/208505 at 0.0 MiB/s (90%) (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=183)
    Jul 01 19:21:48 ilum syncthing[1415]: walker/2rjpi-uewi7@0xcd9134f91e0: Walk 2rjpi-uewi7 [ArchLinux/PKGBUILDs/.git/objects/a2/192d51a748abd996fc5ede38f022da61533ba4 ArchLinux/PKGBUILDs/.git/objects/d4/aff4e1e2d252bb1b0a7612e2fcf0ed34e62c08 ArchLinux/PKGBUILDs/.git/objects/pack/pack-8672532484142e0f5f6b071197821b9134bdf541.pack ArchLinux/PKGBUILDs/.git/subtree-cache/1451588] current progress 187661/208505 at 0.0 MiB/s (90%) (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=183)
    Jul 01 19:21:49 ilum syncthing[1415]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/1451588/notree/9a931da8a0b39ff27f033ea6b8f863c7bfca71bd", Sequence:0, Permissions:0644, ModTime:2026-07-01 19:10:47.832681143 +0200 CEST, Version:{[{ENURVPV 1782925864}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Jul 01 19:21:49 ilum syncthing[1415]: walker/2rjpi-uewi7@0xcd9134f91e0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/1451588/notree/53e87bee18bf67140a6dfb15e8efb9737c7bfa07 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Jul 01 19:21:49 ilum syncthing[1415]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/1451588/notree/9a931da8a0b39ff27f033ea6b8f863c7bfca71bd", Sequence:0, Permissions:0644, ModTime:2026-07-01 19:10:47.832681143 +0200 CEST, Version:{[{ENURVPV 1782925864}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Jul 01 19:21:50 ilum syncthing[1415]: walker/2rjpi-uewi7@0xcd9134f91e0: Walk 2rjpi-uewi7 [ArchLinux/PKGBUILDs/.git/objects/a2/192d51a748abd996fc5ede38f022da61533ba4 ArchLinux/PKGBUILDs/.git/objects/d4/aff4e1e2d252bb1b0a7612e2fcf0ed34e62c08 ArchLinux/PKGBUILDs/.git/objects/pack/pack-8672532484142e0f5f6b071197821b9134bdf541.pack ArchLinux/PKGBUILDs/.git/subtree-cache/1451588] current progress 187663/208505 at 0.0 MiB/s (90%) (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=183)
    Jul 01 19:21:52 ilum syncthing[1415]: walker/2rjpi-uewi7@0xcd9134f91e0: Walk 2rjpi-uewi7 [ArchLinux/PKGBUILDs/.git/objects/a2/192d51a748abd996fc5ede38f022da61533ba4 ArchLinux/PKGBUILDs/.git/objects/d4/aff4e1e2d252bb1b0a7612e2fcf0ed34e62c08 ArchLinux/PKGBUILDs/.git/objects/pack/pack-8672532484142e0f5f6b071197821b9134bdf541.pack ArchLinux/PKGBUILDs/.git/subtree-cache/1451588] current progress 187663/208505 at 0.0 MiB/s (90%) (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=183)
    (snip)

    As you can see, logs show 0.0 MiB/s. I guess in older versions this would be a larger number, and scanning was way faster.

  4. iyanmv commented on Jul 1, 2026

    @iyanmv
    Author

    For reference, this is on a AMD Ryzen 9 7900X3D. So the CPU should not be a problem :)

    Image
  5. calmh commented on Jul 2, 2026

    @calmh
    Member

    I doubt this is Syncthing-side or there'd be people with pitchforks everywhere, more likely to be something related to hardware or the system as a whole, imho.

    The "MB/s" measure is never going to be particularly useful for lots of two-byte files, but also reading a two-byte file shouldn't take a couple of seconds which is apparently what's happening in the logs. 🤷

  6. iyanmv commented on Jul 2, 2026

    @iyanmv
    Author

    I doubt this is Syncthing-side or there'd be people with pitchforks everywhere, more likely to be something related to hardware or the system as a whole, imho.

    Well, I've been using syncthing for years now with the exact same hardware, and this slow scanning only happens recently. So I doubt it's a hardware thing. It can be a regression due to some other updates (kernel, crypto library?). Any ideas?

    The "MB/s" measure is never going to be particularly useful for lots of two-byte files, but also reading a two-byte file shouldn't take a couple of seconds which is apparently what's happening in the logs. 🤷

    Yes, exactly. So I guess you cannot reproduce this on your side?

  7. calmh commented on Jul 2, 2026

    @calmh
    Member

    I cannot, but looking again at your screenshots I suspect it's probably a database bottleneck with the 1.5 million files.

  8. calmh commented on Jul 7, 2026

    @calmh
    Member

    You might try turning off block indexing for this folder.

  9. iyanmv commented on Jul 10, 2026

    @iyanmv
    Author

    You might try turning off block indexing for this folder.

    I can try this. But I'm still confused about your reasoning here. The change from LevelDB to SQLite happened in 2.0. I didn't have any performance issues after the upgrade 1.x to 2.x. And the number of files in that folder was roughly the same, or comparable.

    I could do a git bisect... I'm just surprised no one else is having similar performance issues recently.

  10. iyanmv commented on Jul 13, 2026

    @iyanmv
    Author

    I have disabled the block indexing and the scanning remains very slow, no difference at all.

  11. iyanmv commented on Jul 13, 2026

    @iyanmv
    Author

    I only disabled in one of the clients. Will try to disable on both ends and see if it makes a difference.

  12. iyanmv commented on Jul 13, 2026

    @iyanmv
    Author

    Yeah, no difference, and I guess I can discard an Arch Linux packaging issue since in the server I'm using the official docker image syncthing/syncthing) and the scanning is also slow.

  13. calmh commented on Jul 13, 2026

    @calmh
    Member

    Post a support bundle taken while it's scanning please, maybe the profiles and metrics will contain something useful.

  14. iyanmv commented on Jul 14, 2026

    @iyanmv
    Author
  15. 32 remaining items

  16. iyanmv commented on Aug 4, 2026

    @iyanmv
    Author

    Is the fix included in v2.1.3-rc.3? If yes, scanning is still very slow in this pre-release on my side. And not only that, now apparently the scanner is entering the .git subdirectories that are covered by an ignore pattern (using an absolute path)

  17. iyanmv commented on Aug 4, 2026

    @iyanmv
    Author

    It looks like it is included since the rc.2. From my side, I honestly don't notice a difference with respect to v2.1.2. @SoongVilda maybe you can check with your use case if performance has increased on your side?

  18. tomasz1986 commented on Aug 4, 2026

    @tomasz1986
    Member

    And not only that, now apparently the scanner is entering the .git subdirectories that are covered by an ignore pattern (using an absolute path)

    What kind of a path are you trying to use? Ignore patterns can only be relative to the folder in question (see https://docs.syncthing.net/users/ignoring), absolute paths have never been supported.

  19. SoongVilda commented on Aug 4, 2026

    @SoongVilda

    It looks like it is included since the rc.2. From my side, I honestly don't notice a difference with respect to v2.1.2. @SoongVilda maybe you can check with your use case if performance has increased on your side?

    I can check it with my use case, sure. It would be immediately, but I'll do it.

  20. iyanmv commented on Aug 4, 2026

    @iyanmv
    Author

    And not only that, now apparently the scanner is entering the .git subdirectories that are covered by an ignore pattern (using an absolute path)

    What kind of a path are you trying to use? Ignore patterns can only be relative to the folder in question (see https://docs.syncthing.net/users/ignoring), absolute paths have never been supported.

    Sorry, by "absolute path" I meant a pattern starting with /, but of course relative to the synced folder.

    In particular, I have this line in the .stignore:

    /ArchLinux/PKGBUILDs
    

    But the scanner is going (very slowly) through files in /ArchLinux/PKGBUILDs/*/.git.

    Note that I do not have any pattern with !.

  21. SoongVilda commented on Aug 4, 2026

    @SoongVilda

    Thanks, that clarifies it. /ArchLinux/PKGBUILDs should match the directory itself and everything below it, so the pattern looks valid. Since you also have no negated patterns, Syncthing should not need to enter that directory to search for included files.

    Before I try to reproduce it, could you collect a little more information from the exact slow scan?

    • A support bundle from rc.3 taken while the scan is slow.
    • A few representative scanner debug lines mentioning ArchLinux/PKGBUILDs.
    • Whether this was a full manual scan or activity triggered by the filesystem watcher.
    • Whether this is the first scan after adding or changing the ignore pattern.
    • Whether another scan is still slow after the current one completes.
    • Roughly how long the scan has been running and whether it eventually finishes.

    The exact log messages should help a lot. If they contain walker, real to hash, or parallelhasher, Syncthing is actually traversing or hashing files below the ignored directory. That would look like a separate problem with ignore handling.

    If they instead contain Marking file as ignored, Syncthing may be going through files that were already indexed and updating their database state after the ignore pattern changed. With so many files, that could make the first scan slow even though Syncthing is no longer reading or hashing their contents.

    It would also help to know whether /ArchLinux/PKGBUILDs was already in .stignore before installing rc.3, or whether it was added afterwards. Did you replace the earlier (?d).git pattern with this one, or are both currently present?

    Once we know which part of the scanner is taking the time, I can reproduce that specific case with an isolated configuration and design the benchmark around the same sequence of events.

  22. iyanmv commented on Aug 4, 2026

    @iyanmv
    Author

    Before I try to reproduce it, could you collect a little more information from the exact slow scan?

    Let me quickly answer a few things here, and tomorrow I'll provide the rest of the things you asked.

    * A support bundle from rc.3 taken while the scan is slow.
    * A few representative scanner debug lines mentioning `ArchLinux/PKGBUILDs`.
    * Whether this was a full manual scan or activity triggered by the filesystem watcher.
    

    First scan after I restarted the service after upgrading the package.

    * Whether this is the first scan after adding or changing the ignore pattern.
    

    I have tried a few things, so neither.

    I first removed my previous ignore pattern, (?d)/ArchLinux/PKGBUILDs/**/.git (if I remember correctly), assuming that the fix would solve the slow scan. At the beginning of the issue I did use (?d).git, but after I identified this directory to be the problematic I replaced the generic ignore with this one more specific. Then, after I noticed that the scan was still very slow, I stopped the service, added the new ignore pattern to simply ignore that whole directory (I've been using rsync manually for this directory until the issue is solved for me). This also didn't solve the slow scan so the last thing I did was deleting the whole folder in my laptop, and reset the database with syncthing debug reset-database. Even after doing all this, and with the folder gone, I still get in the logs lines like these ones:

    Aug 04 23:56:01 bespin syncthing[58682]: walker/2rjpi-uewi7@0x3ba71ad66000 real to hash: PKGBUILDs/.git/subtree-cache/99165/notree/0b8e3a96556d460b927514846f5350f1353fc67a (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 04 23:56:01 bespin syncthing[58682]: completed hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/389d84a32e55a86ba79d8890b5676d24b7ca754a", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:47.790707221 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 04 23:56:01 bespin syncthing[58682]: started hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/0b8e3a96556d460b927514846f5350f1353fc67a", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:57.357577691 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 04 23:56:01 bespin syncthing[58682]: walker/2rjpi-uewi7@0x3ba71ad66000 real to hash: PKGBUILDs/.git/subtree-cache/99165/notree/7b7e0766ed1f82048d852af86c1afd906c0d84ff (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 04 23:56:01 bespin syncthing[58682]: completed hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/0b8e3a96556d460b927514846f5350f1353fc67a", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:57.357577691 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 04 23:56:01 bespin syncthing[58682]: started hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/7b7e0766ed1f82048d852af86c1afd906c0d84ff", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:49.205687943 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 04 23:56:01 bespin syncthing[58682]: walker/2rjpi-uewi7@0x3ba71ad66000 real to hash: PKGBUILDs/.git/subtree-cache/99165/notree/4f73e99f45d46f6b22df533347efd297f619a475 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 04 23:56:01 bespin syncthing[58682]: completed hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/7b7e0766ed1f82048d852af86c1afd906c0d84ff", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:49.205687943 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 04 23:56:01 bespin syncthing[58682]: started hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/4f73e99f45d46f6b22df533347efd297f619a475", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:49.243687426 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 04 23:56:01 bespin syncthing[58682]: walker/2rjpi-uewi7@0x3ba71ad66000 real to hash: PKGBUILDs/.git/subtree-cache/99165/notree/b0a884f0b30125cc6aa9c83c9f27f1cc8807315c (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 04 23:56:01 bespin syncthing[58682]: completed hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/4f73e99f45d46f6b22df533347efd297f619a475", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:49.243687426 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 04 23:56:01 bespin syncthing[58682]: started hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/b0a884f0b30125cc6aa9c83c9f27f1cc8807315c", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:54.900610775 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 04 23:56:01 bespin syncthing[58682]: walker/2rjpi-uewi7@0x3ba71ad66000 real to hash: PKGBUILDs/.git/subtree-cache/99165/notree/8043b5a2c958c7ab4597f7e19806f6f2462b8b08 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 04 23:56:01 bespin syncthing[58682]: completed hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/b0a884f0b30125cc6aa9c83c9f27f1cc8807315c", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:54.900610775 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 04 23:56:01 bespin syncthing[58682]: started hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/8043b5a2c958c7ab4597f7e19806f6f2462b8b08", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:51.651654718 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 04 23:56:01 bespin syncthing[58682]: walker/2rjpi-uewi7@0x3ba71ad66000 real to hash: PKGBUILDs/.git/subtree-cache/99165/notree/1932036d079e6d6839a8712a48e0d599b81ff822 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 04 23:56:01 bespin syncthing[58682]: completed hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/8043b5a2c958c7ab4597f7e19806f6f2462b8b08", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:51.651654718 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 04 23:56:01 bespin syncthing[58682]: started hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/1932036d079e6d6839a8712a48e0d599b81ff822", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:49.096689426 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 04 23:56:01 bespin syncthing[58682]: walker/2rjpi-uewi7@0x3ba71ad66000 real to hash: PKGBUILDs/.git/subtree-cache/99165/notree/b4c7ab6b110a5207d224971f2abb96272069ed85 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 04 23:56:01 bespin syncthing[58682]: completed hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/1932036d079e6d6839a8712a48e0d599b81ff822", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:49.096689426 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 04 23:56:01 bespin syncthing[58682]: started hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/b4c7ab6b110a5207d224971f2abb96272069ed85", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:47.849706416 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 04 23:56:01 bespin syncthing[58682]: walker/2rjpi-uewi7@0x3ba71ad66000 real to hash: PKGBUILDs/.git/subtree-cache/99165/notree/d6d699ab14053f6af64023881bc65ec78af366e6 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 04 23:56:01 bespin syncthing[58682]: completed hashing: File{Name:"PKGBUILDs/.git/subtree-cache/99165/notree/b4c7ab6b110a5207d224971f2abb96272069ed85", Sequence:0, Permissions:0644, ModTime:2025-07-24 00:01:47.849706416 +0200 CEST, Version:{[{RKYNXP6 1785879927}]}, Length:2, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:7d759b16b9254aaca9ffb2fddaf5e97ef724f28d7428e0b3409f82ca82b4b09a, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    

    Okay, and when copying-pasting this and seeing the path I realized that I did a mistake with rsync and there was another copy of PKGBUILDs directly on the root of the synced folder... this one not covered by the ignore pattern.

    Sorry about that...

    * Whether another scan is still slow after the current one completes.
    * Roughly how long the scan has been running and whether it eventually finishes.
    

    Honestly, I don't know. I don't mind leaving long scans in the desktop, but in the laptop is quite annoying and it impacts the battery too much. I just stopped the service.

    The exact log messages should help a lot. If they contain walker, real to hash, or parallelhasher, Syncthing is actually traversing or hashing files below the ignored directory. That would look like a separate problem with ignore handling.

    If they instead contain Marking file as ignored, Syncthing may be going through files that were already indexed and updating their database state after the ignore pattern changed. With so many files, that could make the first scan slow even though Syncthing is no longer reading or hashing their contents.

    It would also help to know whether /ArchLinux/PKGBUILDs was already in .stignore before installing rc.3, or whether it was added afterwards. Did you replace the earlier (?d).git pattern with this one, or are both currently present?

    I think I explained this already above. I did use (?d).git at first, but that was not convenient and once I figured out that this directory was the reason of the slow scans I replaced the generic pattern with just the .git inside that directory. I never had both preset at the same time. If it helps, this is the whole file:

    /ArchLinux/PKGBUILDs
    (?d)build
    (?d)__pycache__
    (?d).venv
    (?d)venv
    (?d).idea
    new_ver.json
    (?d).directory
    

    Once we know which part of the scanner is taking the time, I can reproduce that specific case with an isolated configuration and design the benchmark around the same sequence of events.

    Alright. Let me try tomorrow again. And I will also update the docker image in the server to the rc.3.

  23. iyanmv commented on Aug 5, 2026

    @iyanmv
    Author

    Okay, I have updated all my devices to the final release 2.1.3, replace the ignore pattern with (?d)/ArchLinux/**/{src,pkg} and restarted the services. I cannot download a support bundle for some reason... but I'm looking at ~14d and increasing scanning time.

    Here are some logs from the scanner in debug mode:

    Aug 05 17:46:26 bespin syncthing[32776]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/91e0b0a2b5602726d88ee20a5c2b4506a166213e", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:16.627651021 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 05 17:46:26 bespin syncthing[32776]: walker/2rjpi-uewi7@0x326478d100b0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/994054/8d8e15dd26c953202047b7f3d83229d7bca373b4 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 05 17:46:26 bespin syncthing[32776]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/91e0b0a2b5602726d88ee20a5c2b4506a166213e", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:16.627651021 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:28f2422c153899ae8644eac94b604c7c00e3327bbd1835418c90c29fa28f903d, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 05 17:46:26 bespin syncthing[32776]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/8d8e15dd26c953202047b7f3d83229d7bca373b4", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:18.882637204 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 05 17:46:26 bespin syncthing[32776]: walker/2rjpi-uewi7@0x326478d100b0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/994054/43d879a24b076341737fe8336558dd0cba510e3d (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 05 17:46:26 bespin syncthing[32776]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/8d8e15dd26c953202047b7f3d83229d7bca373b4", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:18.882637204 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:11dd8042fef140206311bb778638a0973c5cd4b8b78a398b18fb2f182e392638, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 05 17:46:26 bespin syncthing[32776]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/43d879a24b076341737fe8336558dd0cba510e3d", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:15.285659244 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 05 17:46:26 bespin syncthing[32776]: walker/2rjpi-uewi7@0x326478d100b0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/994054/c4194b311d554d4644a37a1e1d4e9afaab317afe (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 05 17:46:26 bespin syncthing[32776]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/43d879a24b076341737fe8336558dd0cba510e3d", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:15.285659244 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:6d8d7d4a1a5755438b6a7202a58ba98df110df39e04132d982e5ecf2d72554a1, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 05 17:46:26 bespin syncthing[32776]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/c4194b311d554d4644a37a1e1d4e9afaab317afe", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:17.968642804 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 05 17:46:26 bespin syncthing[32776]: walker/2rjpi-uewi7@0x326478d100b0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/994054/f5d62becd8fc446dc34a8f2c56caf4e1b77f6508 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 05 17:46:26 bespin syncthing[32776]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/c4194b311d554d4644a37a1e1d4e9afaab317afe", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:17.968642804 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:ebc82f66a585765b36cfea1add487f8866f6e9be52930ffc6df8fbc5b32fbccc, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 05 17:46:26 bespin syncthing[32776]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/f5d62becd8fc446dc34a8f2c56caf4e1b77f6508", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:18.310640709 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 05 17:46:26 bespin syncthing[32776]: walker/2rjpi-uewi7@0x326478d100b0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/994054/9a1c493ca34dbde5b336f47438cc870bb804e6ce (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 05 17:46:26 bespin syncthing[32776]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/f5d62becd8fc446dc34a8f2c56caf4e1b77f6508", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:18.310640709 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:11dd8042fef140206311bb778638a0973c5cd4b8b78a398b18fb2f182e392638, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 05 17:46:26 bespin syncthing[32776]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/9a1c493ca34dbde5b336f47438cc870bb804e6ce", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:20.424627756 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 05 17:46:26 bespin syncthing[32776]: walker/2rjpi-uewi7@0x326478d100b0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/994054/5bedaa3f873466dc4e44791d42029075685372c1 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 05 17:46:26 bespin syncthing[32776]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/9a1c493ca34dbde5b336f47438cc870bb804e6ce", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:20.424627756 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:33b47323e566d7467658a49e60f7f443ea7e10fe7806e83df7e189d2289e9848, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 05 17:46:26 bespin syncthing[32776]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/5bedaa3f873466dc4e44791d42029075685372c1", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:21.457621426 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 05 17:46:26 bespin syncthing[32776]: walker/2rjpi-uewi7@0x326478d100b0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/994054/32273ccdbb85b79c1a7ab2a33564a1dbf3451984 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 05 17:46:26 bespin syncthing[32776]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/5bedaa3f873466dc4e44791d42029075685372c1", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:21.457621426 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:33b47323e566d7467658a49e60f7f443ea7e10fe7806e83df7e189d2289e9848, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)
    Aug 05 17:46:26 bespin syncthing[32776]: started hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/32273ccdbb85b79c1a7ab2a33564a1dbf3451984", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:20.209629073 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:0, BlocksHash:, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=104)
    Aug 05 17:46:26 bespin syncthing[32776]: walker/2rjpi-uewi7@0x326478d100b0 real to hash: ArchLinux/PKGBUILDs/.git/subtree-cache/994054/f8955401ae611fc62a96902b371202cd41761bd8 (log.pkg=scanner log.type=walker log.src.file=walk.go log.src.line=210)
    Aug 05 17:46:26 bespin syncthing[32776]: completed hashing: File{Name:"ArchLinux/PKGBUILDs/.git/subtree-cache/994054/32273ccdbb85b79c1a7ab2a33564a1dbf3451984", Sequence:0, Permissions:0644, ModTime:2025-02-17 17:19:20.209629073 +0100 CET, Version:{[{RKYNXP6 1785943820}]}, Length:41, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131072, NumBlocks:1, BlocksHash:86803e5ca14b66b84af6e6cbb9d8e063e4cc3b2d340d50166064094b2fc2e9c3, Platform:{<nil> <nil> <nil> <nil> <nil> <nil>}} (log.pkg=scanner log.type=parallelhasher log.src.file=blockqueue.go log.src.line=128)

    I'll try to get the support bundle and attach it here.

  24. iyanmv commented on Aug 5, 2026

    @iyanmv
    Author

    I've tried with Chromium, Firefox and Falkon. They all give a ERR_EMPTY_RESPONSE error when trying to download the support bundle. Don't know if this is a new issue or I'm doing something wrong. Previous times I could download this bundle without any issues at all.

  25. tomasz1986 commented on Aug 5, 2026

    @tomasz1986
    Member

    The support bundle seems broken in v2.1.3 (reported in #10847).

  26. iyanmv commented on Aug 5, 2026

    @iyanmv
    Author

    The support bundle seems broken in v2.1.3 (reported in #10847).

    Okay, good, I was about to say that I tried with curl directly and I got also an error.

  27. iyanmv commented on Aug 5, 2026

    @iyanmv
    Author

    @imsodin Please reopen this issue. #10833 does not fix the regression I originally described here. It might fix some of the metrics and numbers than @SoongVilda observed, but syncing my folder with git subtrees is still not feasible, when it was not a problem before v2.1.0. With final release v2.1.3, without ignoring that folder, scanning is expected to be longer than a month. Ignoring that folder is ~7 mins.

  28. SoongVilda commented on Aug 6, 2026

    @SoongVilda

    @iyanmv I went back to this after your v2.1.3 report and ran a broader set of
    isolated benchmarks. I need to qualify what I said earlier: #10833 fixes the
    repeated IsDeleted problem I measured in the 400+400-file test, but it does
    not completely restore the pre-regression behavior once a scan crosses an
    update-batch boundary. There is also a separate database iteration cost which
    #10833 does not address.

    I tested b1ccf3f3 (before #10653), 2721b7b5 (first bad), ec35a953
    (#10819), ed6b56d4 (#10833), 946e2b83 (v2.1.3), and current main at
    328d910aee822178f55442c76bc7e35ce34d68cc. Each repetition used a fresh
    home, database, and test directory. The watcher and periodic rescans were off,
    and only the manual scan was timed. These are medians of three runs after a
    separate correctness run, with a 120 s timeout:

    Test Before #10653 First bad With relevant fix v2.1.3 main
    Add 400 identical files to 400 existing files 0.543 s 11.569 s #10833: 0.423 s 0.443 s 0.423 s
    Add 2,000 identical files to 2,000 existing files 12.131 s >120 s #10833: 9.253 s 9.304 s 9.240 s
    Fresh database with 4,000 identical files 14.635 s >120 s #10833: 11.093 s 11.191 s 11.190 s
    Change only mtimes of 2,000 identical existing files 9.837 s >120 s #10819: 0.584 s 0.686 s 0.626 s
    Rewrite 2,000 existing files to identical content 2.877 s 25.061 s #10819: 0.503 s 0.584 s 0.524 s

    The timings are specific to my machine. The more useful result came from
    counting candidate rows returned by AllLocalFilesWithBlocksHash and
    IsDeleted calls made by findRename.

    In the 400+400 test the first bad commit returned 160,000 candidate rows and
    made 160,000 IsDeleted calls. With #10833 it still returned all 160,000 rows,
    but made only 400 IsDeleted calls. So the original result was real: #10833
    does fix the repeated filesystem checks within one batch.

    Across several batches I got this instead:

    Test Revision Candidate rows IsDeleted calls
    Add 2,000 to 2,000 before #10653 5,000,999 3,999
    Add 2,000 to 2,000 #10833 / v2.1.3 / main 5,000,999 8,998
    Fresh 4,000 before #10653 6,006,951 3,993
    Fresh 4,000 #10833 / v2.1.3 / main 6,006,951 9,972

    The check counts follow the 1,000-file flushes exactly. For a fresh scan on
    v2.1.3 they were:

    1,000 files:    993
    2,000 files:  2,986 = 993 + 1,993
    4,000 files:  9,972 = 993 + 1,993 + 2,993 + 3,993
    

    This seems to come from clear(b.skipInFindRename) in the batch callback. The
    old alreadyUsedOrExisting map lasted for the whole scan; the new map lasts
    for one scanBatch. A candidate confirmed to exist is therefore remembered
    inside a batch and checked again after the next flush. I also checked the batch
    code with a small Go test: the same callback runs at exactly 1,000 files or
    5,000 blocks. The file boundary is visible above; I only checked the block
    boundary at Go level.

    The other remaining part is candidate iteration. Here is the fresh-database
    scaling result for v2.1.3:

    Files Scan time Candidate rows Rows/file
    500 0.141 s 0 0
    1,000 0.384 s 6,951 6.951
    2,000 2.316 s 1,006,951 503.476
    4,000 11.237 s 6,006,951 1,501.738

    Going from 2,000 to 4,000 files increased the row count 5.97x and scan time
    4.85x. findRename still performs one lookup for every new nonempty file, and
    matching rows are yielded before skipInFindRename is consulted. #10833 saves
    filesystem calls after those rows have been decoded; it does not save the
    queries or row decoding. As a control, 3,000 same-sized files with unique
    contents produced 3,000 lookups, zero candidate rows, and zero rename-related
    IsDeleted calls. Toggling block indexing did not change these counts.

    #10819 is clearer. In both existing-path cases above (mtime-only changes and
    content rewrites), rename lookups, candidate rows, and IsDeleted calls all
    went to zero. It cannot help the fresh-database case because there is no old
    entry for the path to compare with.

    All completed correctness runs ended with the expected paths and hashes. Four
    first-bad runs hit the timeout and were stopped. The first-bad profile for the
    2,000+2,000 test had about 75% of cumulative sampled CPU below
    osutil.IsDeleted and about 73% below the Lstat stack, which agrees with the
    old failure mode. After #10833, the exact 4,000-file counts (6,006,951 database
    rows versus 9,972 checks) point to database iteration as the larger remaining
    avoidable cost in this synthetic case.

    v2.1.3 therefore matches the pre-regression behavior for the single-batch B1
    case, and #10819 removes the regression path in B4/B5. It does not match the
    old filesystem-check counts for multi-batch B2/B3, even though it happened to
    finish faster on this machine. The candidate-row counts in B2/B3 are the same
    as before the regression. Current main has no later change in this code and
    gave the same counters as v2.1.3.

    This also makes your v2.1.3 result plausible without contradicting the earlier
    400+400 benchmark. The worst per-row filesystem checking is gone, but a fresh
    database still hashes every file, and a large identical-content group can
    still cause millions of SQLite candidate rows to be read. Without a profile
    from the slow real-world scan I cannot say which one dominates there.

    For a regression test, I think the smallest useful case would use an injectable
    batch limit (say 8) and 17-24 identical nonempty files with counted fake
    database and filesystem operations. It should check that a confirmed-existing
    candidate is tested at most once per scan, including across flushes, and that
    the same candidate rows are not decoded once per file. A separate test at the
    real 1,000-file boundary would make sense too.

    For a fix, I would first separate batch-local “rename source already consumed”
    state from scan-wide “candidate confirmed to exist” state. Caching candidates
    by (BlocksHash, size) for the duration of the scan would address the repeated
    database iteration as well.

  29. iyanmv commented on Aug 19, 2026

    @iyanmv
    Author

    Trying again. @calmh @imsodin please reopen this issue as we don't have permissions to do it and the regression was not completely fixed.

  30. moerkey commented on Aug 26, 2026

    @moerkey

    We're seeing a similar pattern and can add a data point.

    Setup: Migrated from Syncthing v1.30.0 to v2.1.3, folder shares a Drupal codebase with roughly 38k files (large mix of small files, incl. a media/asset tree).

    We initially suspected a Drupal-specific cache directory (files/php/twig) as the cause of high CPU/scan load, since it's rewritten very frequently by the application. We added it to .stignore to rule it out.

    However, even with that directory excluded, the hourly full rescan (rescanIntervalS) still causes sustained high CPU usage and drives the host into heavy swap usage for the duration of the scan. This didn't happen under v1.30.0 with the same folder structure and scan interval.

    Happy to provide a support bundle if useful, and can also try disabling "Block Indexing" per the folder advanced settings if that's a plausible avenue worth testing on our end.

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

    bugneeds-triage

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions