Skip to content

Copy fails on OneDrive when source changes #4590

Closed

Description

@BeansIsFat

What is the problem you are having with rclone?

On a OneDrive remote, if a file in the source directory was previously copied to the destination, any changes to the source file cause the copy command to fail. If the file is not already in the remote, the copy command succeeds.

See also https://forum.rclone.org/t/copy-fails-on-onedrive-when-source-changes/19097

What is your rclone version (output from rclone version)

rclone v1.53.0

Which OS you are using and how many bits (eg Windows 7, 64 bit)

MacOS 10.14.6

Which cloud storage system are you using? (eg Google Drive)

OneDrive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync -vv --timeout=1m --retries 1 onedrive:foo onedrive:bar

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

2020/09/13 20:41:05 DEBUG : rclone: Version "v1.53.0" starting with parameters ["rclone" "copy" "-vv" "--timeout=1m" "--retries" "1" "onedrive:foo" "onedrive:bar"]
2020/09/13 20:41:05 DEBUG : Using config file from "/Users/redacted/.config/rclone/rclone.conf"
2020/09/13 20:41:05 DEBUG : Creating backend with remote "onedrive:foo"
2020/09/13 20:41:06 DEBUG : Creating backend with remote "onedrive:bar"
2020/09/13 20:41:06 DEBUG : One drive root 'bar': Waiting for checks to finish
2020/09/13 20:41:06 DEBUG : foo.txt: Modification times differ by -1m10s: 2020-09-14 00:33:04 +0000 UTC, 2020-09-14 00:31:54 +0000 UTC
2020/09/13 20:41:06 DEBUG : foo.txt: QuickXorHash = 5428c31ce8000219000000000600000000000000 (One drive root 'foo')
2020/09/13 20:41:06 DEBUG : foo.txt: QuickXorHash = 5428c31ce8008218000000000600000000000000 (One drive root 'bar')
2020/09/13 20:41:06 DEBUG : foo.txt: QuickXorHash differ
2020/09/13 20:41:06 DEBUG : One drive root 'bar': Waiting for transfers to finish
2020/09/13 20:42:06 INFO  :
Transferred:   	         0 / 6 Bytes, 0%, 0 Bytes/s, ETA -
Checks:                 1 / 1, 100%
Transferred:            0 / 1, 0%
Elapsed time:       1m1.2s
Transferring:
 *                                       foo.txt:  0% /6, 0/s, -

2020/09/13 20:42:08 ERROR : foo.txt: Failed to copy: async operation didn't complete after 1m0s
2020/09/13 20:42:08 INFO  : There was nothing to transfer
2020/09/13 20:42:08 ERROR : Attempt 1/1 failed with 1 errors and: async operation didn't complete after 1m0s
2020/09/13 20:42:08 INFO  :
Transferred:   	         0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors:                 1 (retrying may help)
Checks:                 1 / 1, 100%
Elapsed time:       1m3.6s

2020/09/13 20:42:08 DEBUG : 7 go routines active
2020/09/13 20:42:08 Failed to copy: async operation didn't complete after 1m0s

Activity

  1. ncw commented on Sep 15, 2020

    @ncw
    Member

    I managed to replicate this

    $ echo hello | rclone rcat onedrive:test/file1.txt
    
    $ rclone -vv copyto onedrive:test/file1.txt onedrive:test/file2.txt
    2020/09/14 16:22:13 DEBUG : rclone: Version "v1.53.1-DEV" starting with parameters ["rclone" "-vv" "copyto" "onedrive:test/file1.txt" "onedrive:test/file2.txt"]
    2020/09/14 16:22:13 DEBUG : Using config file from "/home/ncw/.rclone.conf"
    2020/09/14 16:22:13 DEBUG : Creating backend with remote "onedrive:test/file1.txt"
    2020/09/14 16:22:16 DEBUG : fs cache: adding new entry for parent of "onedrive:test/file1.txt", "onedrive:test"
    2020/09/14 16:22:16 DEBUG : Creating backend with remote "onedrive:test/"
    2020/09/14 16:22:16 DEBUG : fs cache: renaming cache item "onedrive:test/" to be canonical "onedrive:test"
    2020/09/14 16:22:17 DEBUG : file1.txt: Need to transfer - File not found at Destination
    2020/09/14 16:22:19 DEBUG : file1.txt: SHA-1 = f572d396fae9206628714fb2ce00f72e94f2258f OK
    2020/09/14 16:22:19 INFO  : file1.txt: Copied (server side copy)
    2020/09/14 16:22:19 INFO  : 
    Transferred:   	         6 / 6 Bytes, 100%, 3 Bytes/s, ETA 0s
    Transferred:            1 / 1, 100%
    Elapsed time:         5.7s
    2020/09/14 16:22:19 DEBUG : 7 go routines active
    
    $ echo hellohello | rclone rcat onedrive:test/file1.txt
    
    $ rclone -vv copyto onedrive:test/file1.txt onedrive:test/file2.txt
    2020/09/14 16:22:30 DEBUG : rclone: Version "v1.53.1-DEV" starting with parameters ["rclone" "-vv" "copyto" "onedrive:test/file1.txt" "onedrive:test/file2.txt"]
    2020/09/14 16:22:30 DEBUG : Using config file from "/home/ncw/.rclone.conf"
    2020/09/14 16:22:30 DEBUG : Creating backend with remote "onedrive:test/file1.txt"
    2020/09/14 16:22:31 DEBUG : fs cache: adding new entry for parent of "onedrive:test/file1.txt", "onedrive:test"
    2020/09/14 16:22:31 DEBUG : Creating backend with remote "onedrive:test/"
    2020/09/14 16:22:32 DEBUG : fs cache: renaming cache item "onedrive:test/" to be canonical "onedrive:test"
    2020/09/14 16:22:33 DEBUG : file1.txt: Sizes differ (src 11 vs dst 6)
    2020/09/14 16:22:37 ERROR : file2.txt: corrupted on transfer: sizes differ 11 vs 6
    2020/09/14 16:22:37 INFO  : file2.txt: Removing failed copy
    2020/09/14 16:22:38 ERROR : Attempt 1/3 failed with 1 errors and: corrupted on transfer: sizes differ 11 vs 6
    2020/09/14 16:22:38 DEBUG : file1.txt: Need to transfer - File not found at Destination
    2020/09/14 16:22:40 DEBUG : file1.txt: SHA-1 = 60e4cc679a5c273df21513400ccc98dcf88f3df1 OK
    2020/09/14 16:22:40 INFO  : file1.txt: Copied (server side copy)
    2020/09/14 16:22:40 ERROR : Attempt 2/3 succeeded
    2020/09/14 16:22:40 INFO  : 
    Transferred:   	        17 / 17 Bytes, 100%, 2 Bytes/s, ETA 0s
    Transferred:            1 / 1, 100%
    Elapsed time:        10.3s
    2020/09/14 16:22:40 DEBUG : 7 go routines active
    
    $ 
    

    @Cnly have you got time to have a look at this?

  2. Cnly commented on Sep 15, 2020

    @Cnly
    Member

    I also just reproduced this, but got different-looking logs which says file1.txt: Failed to copy: nameAlreadyExists: Name already exists, so I tend to think this is an upstream bug.

  3. BeansIsFat commented on Sep 15, 2020

    @BeansIsFat
    Author

    I think the difference is due to OneDrive Personal vs OneDrive Business. I get the same result as @ncw when using OneDrive Personal and the same result as @Cnly when using OneDrive Business. The original bug report was using OneDrive Business.

  4. Cnly commented on Sep 15, 2020

    @Cnly
    Member

    @BeansIsFat Good observation! Thanks. After some more looking around, I suspect this is a case of the upstream bug OneDrive/onedrive-api-docs#981.

  5. Cnly commented on Sep 18, 2020

    @Cnly
    Member

    In the meanwhile, a workaround may be to delete the destination file first and then run the copy.

  6. BeansIsFat commented on Sep 18, 2020

    @BeansIsFat
    Author

    I've tried that and it does work. Creates a bit of extra effort but I can minimize that by using rclone check --one-way --differ ~/delete-these.txt to make a list of destination files to delete.

    The bug seems to be specific to server-side copies so another workaround, if the files are small enough, is to bypass server-side copying with rclone copy --disable copy.

  7. added this to the Known Problem milestone on Jan 5, 2021
  8. Cnly commented on Jan 5, 2021

    @Cnly
    Member

    According to the comment OneDrive/onedrive-api-docs#981 (comment), I've added a workaround (existing files will now be replaced), but it works for OneDrive for Business only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions