Open abahnasy opened 2 months ago
@skshetry can it be related to the recent changes?
@skshetry what is your take here?
This does not look related to recent changes at all.
with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/interior_sensing/test-dvc/.a4qKiU5jH5cZ124XMHY-dg.tmp
This should never fail as we are opening in mode="wb"
, unless /mnt/interior_sensing/test-dvc
does not exist.
@abahnasy, does that directory exist? Can you try to add os.makedirs(...)
in the script above and see if it works? (I guess it does since unlink
did not return any error).
OS: Linux Python 3.8 dvc 3.55.2 dvc-azure 3.1.0 dvc-data 3.16.5 dvc-http 2.32.0 dvc-objects 5.1.0 dvc-render 1.0.2 dvc-studio-client 0.21.0 dvc-task 0.4.0
Hi,
I come across a special case where the
dvc push
fails due to hosting the remote on a network shared drive (Samba Drive).During pushing the files from the local cache to the remote storage, DVC will reach
copyfile
here and attempt to do CoW (Copy on Write) here but due to the fact that both (cache and remote) are on different file systems, it will fail and try to unlink here the linking happened due to callingfcntl.ioctl()
here and thencopyfile
will try to copy the file usingshutil.copyfile(src, dst)
here. At this point, the call fails due toFileNotFoundError
exception as thedst
is seen as file (os.path.exists(dst)
returnsTrue
) but it is not actually found on the filesystem.it seems that due to network latency or caching from SMB drive, the unlinking here is not reflected immediately and I've to wait few milliseconds until the
dst
path is removed and could be seen as not found on the filesystem (os.path.exists(dst)
returnsFalse
). Then, normal copying usingshutil.copyfile(src, dst)
could work fine.I've written a simple script by extracting the code snippets from lib to reproduce the error.
Error output:
Output after applying the temp fix
I'm not sure if this a case that should be handled or it is a case specific to my setup, but I thought it is worth mentioning.