Repository navigation
local: skip files removed concurrently with List - #5297
Conversation
ncw
left a comment
There was a problem hiding this comment.
The window for this to happen is quite small isn't it?
Do we need to recheck? Maybe just checking for os.IsNotExist on the os.Lstat is enough for us to skip the file. The listing said the file was there - the stat says its missing which means
- the file got deleted, or
- the filesystem is broken
The first is the likely case, the second is very unlikely - I've never seen it. So I'd propose just a log, skip the file and carry on.
Effectivelly your code stats the missing files twice doesn't it? So if you feel uneasy about that you could stat the file twice, but I'm not sure it is necessary.
List
|
I'm easy about it. The digging wasn't quite as easy. :) tl;dr Chunker fell victim of its heavy use of [gory-details]
The interval is large enough for 4+ checkers and 4+ remover gorutines to step on each others toes within a single |
Simpler fix until we need to make it more complicated seems good to me.
No-ones favorite sort of bug - concurrency problems!
:-)
Ah yes. The interval is small in terms of code, but there is IO in there and syscalls which likely the go runtime is scheduling on so what should never happen happens all the time! |
e9bae51 to
32bc588
Compare
403fb39 to
84c8e80
Compare
ncw
left a comment
There was a problem hiding this comment.
This looks OK to me if you want to merge it?
(It is still set to draft)
It's missing unit tests:
|
|
This is going to be very hard to make a test which fails reliably I think, though I'd be delighted to be proved wrong :-) |
Flaky test is "better" (as in "gives you food for thought") than no test. |
This change fixes the bug described below: if a file is removed while the local backend List() runs, the call will flag an accounting error. The bug manifests itself if local backend is the Sync target due to intrinsic concurrency. The odds to hit this bug depend on --checkers and --transfers. Chunker over local backend is affected even more because updating a composite object with a smaller size content translates into removing chunks on the underlying file system and involves a number of List() calls.
|
I have added the unit test which is very short and fails with ~99% probability :) The Description updated. Ready to merge. PTAL 🙏 P.S. This block in caused vscode warning |
|
@ncw ready for 1.56 |
…5297) This change fixes the bug described below: if a file is removed while the local backend List() runs, the call will flag an accounting error. The bug manifests itself if local backend is the Sync target due to intrinsic concurrency. The odds to hit this bug depend on --checkers and --transfers. Chunker over local backend is affected even more because updating a composite object with a smaller size content translates into removing chunks on the underlying file system and involves a number of List() calls.
What is the purpose of this change?
UPDATED on 2021-06-12
This change fixes the bug described below:
if a file is removed while the local backend List() runs, the call will flag an accounting error.
The bug manifests itself if local backend is the Sync target due to intrinsic concurrency.
The odds to hit this bug depend on --checkers and --transfers.
Chunker over local backend is affected even more because updating a composite object
with a smaller size content translates into removing chunks on the underlying file system
and involves a number of List() calls.
This patch will make
Listskip the file.Unit test:
or run the full rclone integration test with
-backends local,chunker.Was the change discussed in an issue or in the forum before?
No
Checklist
I have added documentation for the changes if appropriate.