You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deleted/ignored scan does a SQLite virtual-mtime lookup per file, so large folders never pull #10909
On a large send/receive folder, payload pulls starve even though a needed file is available from a connected peer and there are no pull errors. The folder spends a long time in scanning. A stack sample during that state is not in the GC: it is in the deleted/ignored pass, doing a SQLite virtual-mtime lookup for every local path.
scanSubdirsDeletedAndIgnored calls osutil.IsDeleted on each local index entry. That only needs existence, type, and symlink-parent checks. It was going through mtimeFS.Lstat, which loads a row from the mtimes table even though IsDeleted never uses the mtime.
This is not#10868. That issue is orphan-block GC hitting the time limit on a huge blocks table. We also log that GC line on this folder (~2.5M block rows, 25 chunks, a few chunks per 5–13 minutes). During the pull hang there were zero GC-interrupt lines and a stale WAL. Different function, same “large SQLite folder” neighbourhood.
Syncthing version
v2.1.5 (stock hang), reproduced with a patched v2.1.6-dev build
Platform & operating system
macOS darwin-arm64, folder home ≈ 2.2M files / 370k dirs, one Linux peer
A second thread was in sqlite3_step / sqlite3BtreeTableMoveto the whole sample. REST: state=scanning, needFiles=2, peer connected, CPU ~1% after 66 minutes. No GC was interrupted lines during that hang.
After skipping the virtual-mtime lookup on existence checks (fs.LstatExists, used by IsDeleted and TraversesSymlink; case-conflict wrapping kept):
Not just a slow scan. Pulls never ran until that pass finished.
Stock v2.1.5 on this folder (pid 73232): launched 13:23:32, still in scanSubdirsDeletedAndIgnored → IsDeleted → SQLite GetMtime at 15:07:49 (1 h 44 min). REST stayed scanning, needFiles=2, peer connected, no payload. We did not wait for it to complete. (Completed initial scan at 13:41 / 14:01 in that window were folder restarts from a watcher A/B; REST never left scanning / needFiles=2.)
After skipping the virtual-mtime lookup on existence checks, same folder: 15:32:11 scanning → 15:38:30 completed (6.3 min) → pulled the waiting file at 15:38:33, idle needFiles=0. Two later runs completed in 8.7 and 9.0 min.
On the interleave: yes, scan and pull share the folder Serve loop (lib/model/folder.go). Pull is scheduled on a 1-buffered pullScheduled, and pull() itself returns immediately until initialScanFinished is closed:
select {
case<-f.initialScanFinished:
default:
// Once the initial scan finished, a pull will be scheduledreturntrue, nil
}
The first scan is scanTimer fired at 0 → scanTimerFired → scanSubdirs (walk, then scanSubdirsDeletedAndIgnored on every local name) on that same goroutine. initialScanFinished is only closed after scanSubdirs returns. While that call is in GetMtime, the select is not running, so a queued pull is not taken, and even if pull() were entered it would no-op.
So the interleave is real after the initial scan returns. During this pass it never got a turn. IsDeleted does not need virtual mtime; consulting it on every local name is what kept the serve loop in scanSubdirs.
@calmh I will just mention that since I use synching for my entire HOME directory, I can't use it without this and several other fixes, so I must then keep a forked version with this and other patches to make it run.
Activity
calmh commentedon Oct 5, 2026
Scans and pulls are interleaved. Is this just a longwinded way of saying "scans take longer than I expect"?
jhf commentedon Oct 5, 2026
Not just a slow scan. Pulls never ran until that pass finished.
Stock v2.1.5 on this folder (pid 73232): launched 13:23:32, still in
scanSubdirsDeletedAndIgnored→IsDeleted→ SQLiteGetMtimeat 15:07:49 (1 h 44 min). REST stayedscanning,needFiles=2, peer connected, no payload. We did not wait for it to complete. (Completed initial scanat 13:41 / 14:01 in that window were folder restarts from a watcher A/B; REST never leftscanning/needFiles=2.)After skipping the virtual-mtime lookup on existence checks, same folder: 15:32:11 scanning → 15:38:30 completed (6.3 min) → pulled the waiting file at 15:38:33, idle
needFiles=0. Two later runs completed in 8.7 and 9.0 min.On the interleave: yes, scan and pull share the folder
Serveloop (lib/model/folder.go). Pull is scheduled on a 1-bufferedpullScheduled, andpull()itself returns immediately untilinitialScanFinishedis closed:The first scan is
scanTimerfired at 0 →scanTimerFired→scanSubdirs(walk, thenscanSubdirsDeletedAndIgnoredon every local name) on that same goroutine.initialScanFinishedis only closed afterscanSubdirsreturns. While that call is inGetMtime, theselectis not running, so a queued pull is not taken, and even ifpull()were entered it would no-op.So the interleave is real after the initial scan returns. During this pass it never got a turn.
IsDeleteddoes not need virtual mtime; consulting it on every local name is what kept the serve loop inscanSubdirs.jhf commentedon Oct 5, 2026
So yes, but so much longer it wasn't usable.
Running locally with the fixed binary now.
jhf commentedon Oct 15, 2026
@calmh I will just mention that since I use synching for my entire HOME directory, I can't use it without this and several other fixes, so I must then keep a forked version with this and other patches to make it run.
docs: record syncthing#10909 as the fork's founding issue; correct ga…
docs: record syncthing#10909 as the fork's founding issue; correct ga…
docs: record syncthing#10909 as the fork's founding issue; correct ga…
docs: record syncthing#10909 as the fork's founding issue; correct ga…