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
rclone hangs indefinitely with large --include-from file (100k-300k patterns) and high concurrency settings #9014
The associated forum post URL from https://forum.rclone.org
What is the problem you are having with rclone?
When running rclone copy with a large include file (containing approximately 100,000 to 300,000 directory patterns) and high concurrency settings, the process hangs indefinitely. Attempting to interrupt it with kill -QUIT <pid> results in immediate termination without producing a stack trace for debugging.
Additionally, I'd like to ask about the fastest migration approach for moving a large subset of subdirectories from source_dir. For example, if source_dir contains 1 million directories, but I only want to migrate 300,000 specified ones, what would be the optimal rclone parameters and strategy?
What is your rclone version (output from rclone version)
v1.71.2
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Ubuntu 20.04.6 LTS
Which cloud storage system are you using? (e.g. Google Drive)
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
How to use GitHub
Please use the 👍 reaction to show that you are affected by the same issue.
Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
Subscribe to receive notifications on status change and new comments.
Rclone used to capture the backtraces to the log file, but it looks like that has stopped working after the log re-organization (something else to fix 😢 ) - sorry
Rclone will be outputing the backtrace to stdout so you'll need to capture that, maybe with 2>/tmp/rclone_stacks.log
Or you can use the fixed v1.73.0-beta.9349.4851f1796 on branch master (uploaded in 15-30 mins) which will send backtraces to the file specified by --log-file
hi @ncw, thanks for your nice explanation, after upgrading rclone to v1.72.1, stack traces were generated approximately 10 minutes into an rclone copy command execution. I will regenerate and provide a new one tomorrow. st.log
(*rules).include (fs/filter/rules.go:93-99) is a linear scan that calls Regexp.MatchString for every rule, and IncludeDirectory runs it once per directory entry. With 509,012 --include-from patterns and 0x19f013 = 1,699,859 entries in that one directory, that's ~8.6e11 regex evaluations on a single goroutine — the 256 checkers / 128 transfers are all idle, so concurrency doesn't help. "Listed" is frozen because that one listP callback never returns.
Workaround: a literal directory list via --files-from takes the f.dirs map fast path (O(1), fs/filter/filter.go:474-477) instead of the per-rule regex scan, so it scales. The structural fix is on the matching side — routing literal-prefix /dir/** rules through a map/trie instead of a linear list of regexps.
Activity
ncw commentedon Dec 6, 2025
kill -QUIT the rclone process when it hangs and attach the back trace here.
microyahoo commentedon Dec 7, 2025
I have tried, but the corresponding stack trace was not found in the log file.
strace -ftt -p <pid>strace.PZam4yYP.txt
ncw commentedon Dec 7, 2025
Don't strace it. Run the rclone command. In a different terminal window find its pid with ps ax then
kill -QUIT pid
The back trace will then be in the log
microyahoo commentedon Dec 8, 2025
I have tried but found nothing.
ncw commentedon Dec 9, 2025
Rclone used to capture the backtraces to the log file, but it looks like that has stopped working after the log re-organization (something else to fix 😢 ) - sorry
Rclone will be outputing the backtrace to stdout so you'll need to capture that, maybe with
2>/tmp/rclone_stacks.logThanks
log: fix backtrace not going to the --log-file #9014
ncw commentedon Dec 9, 2025
Or you can use the fixed v1.73.0-beta.9349.4851f1796 on branch master (uploaded in 15-30 mins) which will send backtraces to the file specified by --log-file
log: fix backtrace not going to the --log-file #9014
microyahoo commentedon Dec 12, 2025
hi @ncw, thanks for your nice explanation, after upgrading rclone to v1.72.1, stack traces were generated approximately 10 minutes into an rclone copy command execution. I will regenerate and provide a new one tomorrow.
st.log
microyahoo commentedon Dec 13, 2025
a new backtraces as follows, thanks.
rclone-copy.txt
log: fix backtrace not going to the --log-file rclone#9014
log: fix backtrace not going to the --log-file rclone#9014
Sync from rclone/rclone (#1)
maximilize commentedon Jun 29, 2026
It isn't a deadlock — it's a single CPU-bound goroutine. In
rclone-copy.txt, goroutine 801 is[runnable](not blocked) inside regexp backtracking:(*rules).include(fs/filter/rules.go:93-99) is a linear scan that callsRegexp.MatchStringfor every rule, andIncludeDirectoryruns it once per directory entry. With 509,012--include-frompatterns and0x19f013= 1,699,859 entries in that one directory, that's ~8.6e11 regex evaluations on a single goroutine — the 256 checkers / 128 transfers are all idle, so concurrency doesn't help. "Listed" is frozen because that onelistPcallback never returns.Workaround: a literal directory list via
--files-fromtakes thef.dirsmap fast path (O(1), fs/filter/filter.go:474-477) instead of the per-rule regex scan, so it scales. The structural fix is on the matching side — routing literal-prefix/dir/**rules through a map/trie instead of a linear list of regexps.log: fix backtrace not going to the --log-file rclone#9014
filter: speed up large --include-from lists of directories - fixes rc…
filter: speed up large --include-from lists of directories - fixes #9014
ncw commentedon Oct 14, 2026
I've merged@kaii9 fix for this to master now which means it will be in the latest beta in 15-30 minutes and released in v1.76
log: fix backtrace not going to the --log-file rclone#9014