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 mount do not handle errors for write operations on windows #5465
Having mount on windows does not report any error when writing files, so either destination local filesystem is readonly or remote transfer fails, rclone does not report an error on file close. That result in false writing operations and unexpected missed files after unmount/mounting a drive/folder.
there is also thread about this winfsp/winfsp#365 on WinFSP tracker, to summarize, on Windows after successful write, error code could not be reported in Close/Flush/Release operations.
What is your rclone version (output from rclone version)
1.52, 1.55.1
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Windows 10 x64 version 20H2
Which cloud storage system are you using? (e.g. Google Drive)
local, webdav, s3
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
yes, Flush and Release are NOT candidates here, i think we could just avoid buffering and pass data right on destination during handling write operation, this would dramatically affect performance but some scenarios may require guarantee of data transfer. I just would like to see of how that would work. There would be chucked write so multiple operations would be called for single file, but some remotes support chunked upload so maybe that will work fine? What do you think?
My attempt does not worth your attention:
diff --git a/vfs/write.go b/vfs/write.go
index 4f0590312..0b332fb60 100644
--- a/vfs/write.go+++ b/vfs/write.go@@ -66,7 +66,7 @@ func (fh *WriteFileHandle) openPending() (err error) {
pipeReader, fh.pipeWriter = io.Pipe()
- go func() {+ func() {
// NB Rcat deals with Stats.Transferring, etc.
o, err := operations.Rcat(context.TODO(), fh.file.Fs(), fh.remote, pipeReader, time.Now())
so before diving into i decided to discuss any possible scenario of how that would be solved.
@ncw could you point me the options to rclone copy as it look like there is still i\o error on lower level. But i cant find Truncate in the log file now rclone.log
file is 65MB and it appear on destination fs so i m not sure if we got desired result.
Mounting writeable source result in success for same command.
Nope it does not disappear and sometimes there is non zero size on destination:
kalem@DESKTOP-R6MR0O4 MINGW64 ~/Downloads/rclone-v1.55.1-windows-amd64
$ du -h /x/cefpython3-66.1-py2.py3-none-win32.whl.zip
du: cannot access '/x/cefpython3-66.1-py2.py3-none-win32.whl.zip': No such file or directory
kalem@DESKTOP-R6MR0O4 MINGW64 ~/Downloads/rclone-v1.55.1-windows-amd64
$ ./rclone.exe copy ../cefpython3-66.1-py2.py3-none-win32.whl.zip /x/
2021/08/20 12:36:01 NOTICE: Config file "C:\\Users\\kalem\\.config\\rclone\\rclone.conf" not found - using defaults
2021/08/20 12:36:01 NOTICE: cefpython3-66.1-py2.py3-none-win32.whl.zip: Removing partially written file on error: write \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:01 ERROR : cefpython3-66.1-py2.py3-none-win32.whl.zip: Failed to remove partially written file: remove \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:01 ERROR : cefpython3-66.1-py2.py3-none-win32.whl.zip: Failed to copy: write \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:01 ERROR : Attempt 1/3 failed with 1 errors and: write \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:01 ERROR : Attempt 2/3 failed with 1 errors and: CreateFile \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:01 ERROR : Attempt 3/3 failed with 1 errors and: CreateFile \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:01 Failed to copy: CreateFile \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
kalem@DESKTOP-R6MR0O4 MINGW64 ~/Downloads/rclone-v1.55.1-windows-amd64
$ du -h /x/cefpython3-66.1-py2.py3-none-win32.whl.zip
12K /x/cefpython3-66.1-py2.py3-none-win32.whl.zip
kalem@DESKTOP-R6MR0O4 MINGW64 ~/Downloads/rclone-v1.55.1-windows-amd64
$ du -h ../cefpython3-66.1-py2.py3-none-win32.whl.zip
63M ../cefpython3-66.1-py2.py3-none-win32.whl.zip
kalem@DESKTOP-R6MR0O4 MINGW64 ~/Downloads/rclone-v1.55.1-windows-amd64
$ ./rclone.exe copy ../cefpython3-66.1-py2.py3-none-win32.whl.zip /x/
2021/08/20 12:36:24 NOTICE: Config file "C:\\Users\\kalem\\.config\\rclone\\rclone.conf" not found - using defaults
2021/08/20 12:36:24 ERROR : Attempt 1/3 failed with 1 errors and: CreateFile \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:24 ERROR : Attempt 2/3 failed with 1 errors and: CreateFile \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:24 ERROR : Attempt 3/3 failed with 1 errors and: CreateFile \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
2021/08/20 12:36:24 Failed to copy: CreateFile \\?\X:\cefpython3-66.1-py2.py3-none-win32.whl.zip: The request could not be performed because of an I/O device error.
kalem@DESKTOP-R6MR0O4 MINGW64 ~/Downloads/rclone-v1.55.1-windows-amd64
$ du -h /x/cefpython3-66.1-py2.py3-none-win32.whl.zip
12K /x/cefpython3-66.1-py2.py3-none-win32.whl.zip
On the destination it appears to be 0 bytes according to your image?
Yes, i could check, but file may disappear if i refresh Explorer.
Nope it does not disappear and sometimes there is non zero size on destination:
I don't think this is rclone's fault. Rclone reported the error correctly - the fact that part of the file got written or not is down to the OS isn't it?
Confirm, with --buffer-size=0 i can not write a byte on unwriteable destination, so there is still only point 2:
kalem@DESKTOP-R6MR0O4 MINGW64 /f/Downloads/rclone-v1.57.0-windows-amd64
> ./rclone.exe serve webdav /f/ &
[1] 2059
2021/11/25 22:30:23 NOTICE: Config file "C:\\Users\\kalem\\AppData\\Roaming\\rclone\\rclone.conf" not found - using defaults
2021/11/25 22:30:23 NOTICE: Local file system at //?/F:/: WebDav Server started on http://localhost:8080/
kalem@DESKTOP-R6MR0O4 MINGW64 /f/Downloads/rclone-v1.57.0-windows-amd64
> /rclone.exe mount :webdav: x: --streaming-upload-cutoff=0 -v --webdav-url=http://localhost:8080/ --buffer-size=0 &
[2] 2063
2021/11/25 22:30:50 NOTICE: Config file "C:\\Users\\kalem\\AppData\\Roaming\\rclone\\rclone.conf" not found - using defaults
2021/11/25 22:30:50 INFO : webdav root '': poll-interval is not supported by this remote
2021/11/25 22:30:50 NOTICE: webdav root '': --vfs-cache-mode writes or full is recommended for this remote as it can't streamThe service rclone has been started.kalem@DESKTOP-R6MR0O4 MINGW64 /f/Downloads/rclone-v1.57.0-windows-amd64> cat /dev/random | dd of=/x/test.txt count=1 bs=11+0 records in1+0 records out1 byte copied, 0,0042309 s, 0,2 kB/s2021/11/25 22:30:58 ERROR : test.txt: Failed to copy: The system cannot find the file specified.2021/11/25 22:30:58 ERROR : test.txt: WriteFileHandle.New Rcat failed: The system cannot find the file specified.2021/11/25 22:30:59 ERROR : test.txt: Failed to copy: Method Not Allowed: 405 Method Not Allowed2021/11/25 22:30:59 ERROR : test.txt: WriteFileHandle.New Rcat failed: Method Not Allowed: 405 Method Not Allowed2021/11/25 22:30:59 ERROR : test.txt: WriteFileHandle.Flush error: Method Not Allowed: 405 Method Not Allowed2021/11/25 22:30:59 ERROR : IO error: Method Not Allowed: 405 Method Not Allowedkalem@DESKTOP-R6MR0O4 MINGW64 /f/Downloads/rclone-v1.57.0-windows-amd64>
that is all fine if change on writeable destination.
Activity
ncw commentedon Jul 20, 2021
You wrote on the forum
When do you mean doing the sync write? The choices are
Can you show the code you did so far and I can comment?
kalemas commentedon Jul 20, 2021
yes, Flush and Release are NOT candidates here, i think we could just avoid buffering and pass data right on destination during handling write operation, this would dramatically affect performance but some scenarios may require guarantee of data transfer. I just would like to see of how that would work. There would be chucked write so multiple operations would be called for single file, but some remotes support chunked upload so maybe that will work fine? What do you think?
My attempt does not worth your attention:
so before diving into i decided to discuss any possible scenario of how that would be solved.
ncw commentedon Jul 27, 2021
Did you try with a much larger file (say 1 GB) which is definitely larger than the buffers? That would show if your idea will work or not.
kalemas commentedon Jul 28, 2021
Its 1.1GB, but small file still succeeds.
rclone.log
rclone.txt
ncw commentedon Jul 28, 2021
From the log
Rclone returned an error on the
Writecall hereWhich turned into
this request could not be performed because of an I/O device error.You'll need to copy it using something which doesn't try to truncate the file. You should be able to use
rclone copyfor this instead ofcopy.kalemas commentedon Aug 17, 2021
@ncw could you point me the options to
rclone copyas it look like there is still i\o error on lower level. But i cant find Truncate in the log file nowrclone.log
file is 65MB and it appear on destination fs so i m not sure if we got desired result.
Mounting writeable source result in success for same command.
ncw commentedon Aug 19, 2021
These are the problem lines from the log. The file fails when it is being written.
This gets returned as an IO Error.
On the destination it appears to be 0 bytes according to your image?
kalemas commentedon Aug 19, 2021
it sounds like what we are looking for, isn't it?
Yes, i could check, but file may disappear if i refresh Explorer.
kalemas commentedon Aug 20, 2021
Nope it does not disappear and sometimes there is non zero size on destination:
ncw commentedon Aug 20, 2021
Yes!
I don't think this is rclone's fault. Rclone reported the error correctly - the fact that part of the file got written or not is down to the OS isn't it?
kalemas commentedon Nov 23, 2021
i would agree that error is reported but there are two issues still:
kalemas commentedon Nov 23, 2021
@ncw if i got correctly, last research confirmed that it is possible to perform write synchronous so error would be reported in
write.ncw commentedon Nov 25, 2021
If I try your first example in Linux, I always get an error back from dd. However exactly which error changes.
It can be
or
Windows will never report the error on closing file (see winfsp/winfsp#365 (comment) for why). So some of the time we will never get an error.
I can't solve this. You'll see an
ERRORin the rclone log which rclone passes to the OS but the OS never gives it to theddapplication.However if you add
--buffer-size=0then you should get that synchronous error report on the write so I think Windows should always return the error.So this
Always gives
Which I think Windows will report as
kalemas commentedon Nov 25, 2021
Confirm, with
--buffer-size=0i can not write a byte on unwriteable destination, so there is still only point 2:that is all fine if change on writeable destination.