Skip to content

rclone hangs indefinitely with large --include-from file (100k-300k patterns) and high concurrency settings #9014

Closed

Description

@microyahoo

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.

rclone copy source_dir dest_dir \
  --include-from <include-file.txt> \
  --checkers 128 \
  --transfers 128 \
  --local-no-set-modtime \
  --size-only \
  --log-level DEBUG

The include-file.txt contains only subdirectory patterns from source_dir (one pattern per line).

Each line follows the format:

/YR-AT5-10_20230511_110540/**
/YR-AT5-10_20230511_112144/**
/YR-AT5-10_20230511_130620/**
/YR-AT5-10_20230511_131600/**
/YR-AT5-10_20230511_131620/**
/YR-AT5-10_20230512_060740/**
/YR-AT5-10_20230512_060820/**
/YR-AT5-10_20230512_060840/**
/YR-AT5-10_20230512_061801/**
/YR-AT5-10_20230512_062141/**
/YR-AT5-10_20230512_062201/**
Image

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.

Activity

  1. ncw commented on Dec 6, 2025

    @ncw
    Member

    kill -QUIT the rclone process when it hangs and attach the back trace here.

  2. microyahoo commented on Dec 7, 2025

    @microyahoo
    Author

    I have tried, but the corresponding stack trace was not found in the log file.

    strace -ftt -p <pid>
    strace.PZam4yYP.txt

  3. ncw commented on Dec 7, 2025

    @ncw
    Member

    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

  4. microyahoo commented on Dec 8, 2025

    @microyahoo
    Author

    I have tried but found nothing.

    root@eflops18:~# ps ax | grep rclone
     411229 pts/0    Sl   1717:24 rclone copy /mnt/csi-data-gfs/lidar/deeproute_all/samples/camera_1/ /mnt/yrfs/public-data/training/samples/camera_1/ --checkers 128 --transfers 128 --local-no-set-modtime --size-only --log-level INFO --include-from /tmp/include_3_16246216.txt --log-file /tmp/rclone_copy_1765075249585_3.txt
     413640 pts/0    Sl   1723:54 rclone copy /mnt/csi-data-gfs/lidar/deeproute_all/samples/camera_3/ /mnt/yrfs/public-data/training/samples/camera_3/ --checkers 128 --transfers 128 --local-no-set-modtime --size-only --log-level INFO --include-from /tmp/include_5_944879816.txt --log-file /tmp/rclone_copy_1765075249585_5.txt
     414283 pts/0    Sl   1705:44 rclone copy /mnt/csi-data-gfs/lidar/deeproute_all/samples/camera_4/ /mnt/yrfs/public-data/training/samples/camera_4/ --checkers 128 --transfers 128 --local-no-set-modtime --size-only --log-level INFO --include-from /tmp/include_6_1434465241.txt --log-file /tmp/rclone_copy_1765075249585_6.txt
     761067 pts/0    Sl   976:32 rclone copy /mnt/csi-data-gfs/lidar/deeproute_all/samples/camera_6/ /mnt/yrfs/public-data/training/samples/camera_6/ --checkers 128 --transfers 128 --local-no-set-modtime --size-only --log-level INFO --include-from /tmp/include_8_3817605254.txt --log-file /tmp/rclone_copy_1765075249585_8.txt
    1993355 pts/1    S+     0:00 grep --color=auto rclone
    root@eflops18:~# tail -f /tmp/rclone_copy_1765075249585_3.txt
    2025/12/08 13:48:59 INFO  :
    Transferred:              0 B / 0 B, -, 0 B/s, ETA -
    Checks:                 0 / 0, -, Listed 1768419
    Elapsed time:   1d3h3m0.0s
    
    2025/12/08 13:49:59 INFO  :
    Transferred:              0 B / 0 B, -, 0 B/s, ETA -
    Checks:                 0 / 0, -, Listed 1768419
    Elapsed time:   1d3h4m0.0s
    
    root@eflops18:~# kill -QUIT 411229
    root@eflops18:~# tail -f /tmp/rclone_copy_1765075249585_3.txt
    2025/12/08 13:49:59 INFO  :
    Transferred:              0 B / 0 B, -, 0 B/s, ETA -
    Checks:                 0 / 0, -, Listed 1768419
    Elapsed time:   1d3h4m0.0s
    
    2025/12/08 13:50:59 INFO  :
    Transferred:              0 B / 0 B, -, 0 B/s, ETA -
    Checks:                 0 / 0, -, Listed 1768419
    Elapsed time:   1d3h5m0.0s
    
  5. ncw commented on Dec 9, 2025

    @ncw
    Member

    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

    Thanks

  6. ncw commented on Dec 9, 2025

    @ncw
    Member

    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

  7. microyahoo commented on Dec 12, 2025

    @microyahoo
    Author

    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

    root@a100gpu1:~/zhengliang# ps -ef | grep rclone | grep -v grep
    root     1605409 1289454 99 00:47 pts/4    00:01:47 rclone copy /mnt/csi-data-gfs/lidar/deeproute_all/samples/camera_5/ /mnt/yrfs/public-data/user/zhengliang/camera_5 --include-from /tmp/include_7_1676633996.txt --log-level INFO --checkers 256 --transfers 128 --size-only --local-no-set-modtime --log-file /tmp/camera_5.log
    
    root@a100gpu1:~/zhengliang# cat /tmp/include_7_1676633996.txt | wc -l
    509012
    
  8. microyahoo commented on Dec 13, 2025

    @microyahoo
    Author

    a new backtraces as follows, thanks.

    rclone-copy.txt

  9. added a commit that references this issue on Feb 14, 2026
  10. maximilize commented on Jun 29, 2026

    @maximilize
    Contributor

    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:

    regexp.(*Regexp).tryBacktrack -> MatchString
    github.com/rclone/rclone/fs/filter.(*rule).Match            fs/filter/rules.go:32
    github.com/rclone/rclone/fs/filter.(*rules).include         fs/filter/rules.go:95
    ...IncludeDirectory.1                                       fs/filter/filter.go:483
    github.com/rclone/rclone/fs/list.DirSortedFn.func1({..., 0x19f013, ...})
    

    (*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.

  11. added a commit that references this issue on Oct 13, 2026
    345fb1b
  12. added a commit that references this issue on Oct 14, 2026
    af364f5
  13. ncw commented on Oct 14, 2026

    @ncw
    Member

    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

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions