question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dvc: .dvc/lock and sqlite lock on NFS and CIFS

See original GitHub issue

As it turns out, regular locks can’t be relied on when dvc is running on NFS or CIFS. See https://github.com/iterative/dvc/issues/1823 and https://discordapp.com/channels/485586884165107732/485596304961962003/570270243964846081 .

There are workarounds such as adding proper mnt options or moving dvc project outside with an external cache directory at NFS/CIFS mount, but it would be great to mitigate such issues in general. Here are a few ways to go about it:

One way to go about it is to use git-like locks (which, if I recall correctly, are using symlinks as an atomic way lock/unlock a file). In that case, we would have to use an unlocked sqlite db relying on our .dvc/lock (or maybe introduce a separate special lock specifically for a db).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:28 (21 by maintainers)

github_iconTop GitHub Comments

2reactions
Suorcommented, Aug 27, 2019

The questions need to be answered:

  • can we use symlink locks like git does? Are there any ready to use python implementation? Do NFS/CIFS/LustreFS support atomic symlinks?
  • are there some key-value file backed db which we can switch to from sqlite which works on NFS/CIFS/…?
  • where do we place sqlite db, if we don’t place it within .dvc?
1reaction
Suorcommented, Aug 30, 2019

Some takeouts from discussion with @efiop:

  • if we have good universal locks then this is rather straightforward: use sqlite nolock option, use those locks around sqlite and in place of any current locks.
  • git uses open(O_EXCL | O_CREAT | ...) locks, which don’t work on pre v3 NFS.
  • accesibility of symlinks rely on mount options.
  • flufl locks linked by @efiop above.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Internal Files | Data Version Control - DVC
It contains a SQLite state database that stores hash values for files ... The files themselves are backups of the dvc.lock file that...
Read more >
File Locking And Concurrency In SQLite Version 3
SQLite Version 3.0.0 introduced a new locking and journaling mechanism ... Locking and concurrency control are handled by the pager module.
Read more >
SqLite3 NFS mount issue with locking - can I use something ...
I have read that an option called nobrl can help this issue when the file system in question is CIFS. (its an option...
Read more >
Best system to serve sqlite databases to webservers over a ...
If you have any Windows in the mix, CIFS (Samba) is the way to go, but in an all-linux environment, NFS. That being...
Read more >
SQLite recommends against sharing it on NFS for multiple ...
This is because fcntl() file locking is broken on many NFS implementations. You should avoid putting SQLite database files on NFS if multiple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found