-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add: Fails to add file to shared cache on windows drive mount, regression from 1.7.2 #5255
Comments
Hi @gamis ! Looks like shutil.move properly fallen back to copy&delete logic but then failed to delete the source file https://github.com/python/cpython/blob/117830de332c8dfbd9a437c0968e16e11aa7e6a1/Lib/shutil.py#L581 What are the permissions on |
Hi @efiop , note that the cache file never gets renamed from it's temporary form, with the random suffix. I confirmed that the cache file is complete; it has the same sha-256 as the original file. Also, TC3-096.oct was originally not read-only but it appears dvc changes it to read only at some point. |
I have now tried with a more recent python version (3.8.6, i had been using 3.7.2), and same problem. |
Does that explain why the cache file isn't being renamed from its temp form to the final form? |
@gamis Yeah, it fails to unlink the temporary file, because on windows if file is read-only - you can't delete it. |
@gamis We've adjusted this in the upstream (future 2.0) and reverted the PR that has caused this bug in 1.11.x. 1.11.12 will be out on pypi in a few minutes. Please give it a try and let us know if that works for you. Thanks! 🙏 |
Sorry to say, that didn't fix it! On a separate thread of discussion, I've mentioned that we recently abandoned trying to use this shared cache over the network, instead using it as a "local" remote. But this same Windows issue persists. If I call 2021-01-25 08:55:31,080 DEBUG: Check for update is disabled.
2021-01-25 08:55:31,096 DEBUG: fetched: [(3,)]
2021-01-25 08:57:50,768 DEBUG: Assuming 'H:\researchdata\.dvc\cache\2b\95ceac01304e1ce8511f59b07c5db2.dir' is unchanged since it is read-only
2021-01-25 08:57:50,768 DEBUG: Assuming 'H:\researchdata\.dvc\cache\2b\95ceac01304e1ce8511f59b07c5db2.dir' is unchanged since it is read-only
2021-01-25 08:57:50,768 DEBUG: Assuming 'H:\researchdata\.dvc\cache\15\393c7590870fe4b29f4b6836a38c98.dir' is unchanged since it is read-only
2021-01-25 08:57:50,768 DEBUG: Assuming 'H:\researchdata\.dvc\cache\15\393c7590870fe4b29f4b6836a38c98.dir' is unchanged since it is read-only
2021-01-25 08:57:50,784 DEBUG: Preparing to upload data to 'Z:\researchdata'
2021-01-25 08:57:50,784 DEBUG: Preparing to collect status from Z:\researchdata
2021-01-25 08:57:50,847 DEBUG: Collecting information from local cache...
2021-01-25 08:53:19,893 DEBUG: cache 'H:\researchdata\.dvc\cache\81\466ad7a5e5d242552ae7e170b65bf6' expected 'HashInfo(name='md5', value='81466ad7a5e5d242552ae7e170b65bf6', dir_info=None, size=None, nfiles=None)' actual 'None'
# the above is repeated many times, because I haven't pulled the full dvc repo down to this local cache.
2021-01-25 08:53:20,080 ERROR: unexpected error - [WinError 6] The handle is invalid: 'Z:\\researchdata\\29\\b21cb5993462d6e33980e361652a6b'
------------------------------------------------------------
Traceback (most recent call last):
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\main.py", line 90, in main
ret = cmd.run()
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\command\data_sync.py", line 50, in run
processed_files_count = self.repo.push(
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\repo\__init__.py", line 54, in wrapper
return f(repo, *args, **kwargs)
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\repo\push.py", line 35, in push
return len(used_run_cache) + self.cloud.push(used, jobs, remote=remote)
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\data_cloud.py", line 65, in push
return remote.push(
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\remote\base.py", line 56, in wrapper
return f(obj, *args, **kwargs)
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\remote\base.py", line 432, in push
return self._process(
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\remote\base.py", line 327, in _process
dir_status, file_status, dir_contents = self._status(
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\remote\base.py", line 175, in _status
self.hashes_exist(
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\remote\base.py", line 132, in hashes_exist
return indexed_hashes + self.cache.hashes_exist(list(hashes), **kwargs)
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\cache\local.py", line 47, in hashes_exist
return [
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\cache\local.py", line 55, in <listcomp>
if not self.changed_cache_file(
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\cache\base.py", line 368, in changed_cache_file
self.tree.protect(cache_info)
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\tree\local.py", line 301, in protect
self.chmod(path_info, self.CACHE_MODE)
File "g:\temp\venvs\dvc_regression\lib\site-packages\dvc\tree\local.py", line 249, in chmod
os.chmod(path, mode)
OSError: [WinError 6] The handle is invalid: 'Z:\\researchdata\\29\\b21cb5993462d6e33980e361652a6b'
------------------------------------------------------------
2021-01-25 08:53:20,142 DEBUG: Version info for developers:
DVC version: 1.11.12 (pip)
---------------------------------
Platform: Python 3.8.6 on Windows-10-10.0.18362-SP0
Supports: http, https
Cache types: hardlink, symlink
Caches: local
Remotes: local, ssh, ssh, local
Repo: dvc, git
|
@gamis The move was successful, but |
This is strange because a) it worked in 1.7.2, and b) If I check that cache file on Z, it is indeed read-only for user, group, and other. |
DVC version: 1.11.12 (pip)
---------------------------------
Platform: Python 3.8.6 on Windows-10-10.0.18362-SP0
Supports: http, https
Cache types: hardlink, symlink
Cache directory: NTFS on H:\
Caches: local
Remotes: local, ssh, ssh, local
Workspace directory: NTFS on H:\
Repo: dvc, git |
This happens on |
@gamis It checks if the cache file is intact and tries to set it read-only, so that it doesn't need to check it next time. We could also consider supporting |
That seems like a good option. If other remote types skip it, and people would generally expect a |
@gamis Besides the question of chmoding on remote, I'm still surprised that the chmod error is so odd. It might affect people that have their cache on samba. Leaning towards ignoring such errors for |
Both of these are not fatal and could safely be ignored. Fixes iterative#5255
Both of these are not fatal and could safely be ignored. Fixes #5255
Keeping open for confirmation. Backporting to 1.11.x... |
* dvc: ignore errors on protect/set_exec (#5335) Both of these are not fatal and could safely be ignored. Fixes #5255 (cherry picked from commit 434cd30) * tests: upgrade azurite and enable loose mode Backport of #5272 Co-authored-by: Ruslan Kuprieiev <[email protected]> Co-authored-by: Ruslan Kuprieiev <[email protected]>
@gamis 1.11.13 is out, please give it a try and let us know how it goes. |
It appears that fixed the problem! Thanks as always for all the hard work and determination. |
@gamis Thanks for the feedback! 🙏 |
Bug Report
add: Fails to add file to shared cache on windows drive mount
Description
We have a shared dvc cache on a ZFS file server shared via Samba. On Windows machines, it is mounted as a drive letter. At one point, we could
dvc add
a file from a windows machine, and dvc would move the file to the cache and replace the local file with a symlink, as expected.Somewhere between v1.7.2 and v1.11.10, it stopped working. Specifically, this is what appears to happen:
-v
.Note that this happens even if I change the cache.type to
copy
, even if I run from an Admin-elevated cmd.Note also that the same operation runs just fine using a Ubuntu machine connecting to the same cache.
Reproduce
And you get the error pasted below.
Expected
Expect that dvc would continue to support a shared cache like this.
Environment information
Output of
dvc version
:Additional Information (if any):
From the error output, it seems that dvc expects that a "local" cache is always going to be on the same drive, which is not the case here. Is there a way to tell it not to have that expectation?
I tried reverting to 1.7.2 and confirmed it still works there. I can try searching for the breaking version, but I'd appreciate some guidance.
The text was updated successfully, but these errors were encountered: