Skip to content
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

Lock bit when opening file for writing #625

Open
achilleas-k opened this issue Aug 16, 2016 · 4 comments
Open

Lock bit when opening file for writing #625

achilleas-k opened this issue Aug 16, 2016 · 4 comments

Comments

@achilleas-k
Copy link
Member

It might be a nice idea to have a lock attribute set on the file when it is open for writing, to protect against multiple instances writing to a file simultaneously.

This would protect against accidentally running two processes that write to the same file, which can cause corruption (this just happened), or even against two different people writing to the same file on a remote machine (on a common network share, for instance).

What do you think?

@jgrewe
Copy link
Member

jgrewe commented Aug 16, 2016

did this happen with the hdf5 backend?! This should be capable of parallel access from multiple processes.

@achilleas-k
Copy link
Member Author

This happened with the old (pre pycore) version of nixpy.
I'm not sure whether HDF5 can handle concurrent writes to the same group/dataset. If you say it should, maybe something else caused the corruption.

@ajkswamy
Copy link

Hi Jan

We were using a nix file that was on machine A which was also mounted on machine B using sshfs over the local network. A process on machine A opened and started writing into the nix file. Before it finished writing and closed the nix file, a process on machine B opened and started writing into the mounted nix file. Both processes finished without error. However, in the resulting nix file, a section that was written into by both the processes could no longer be opened (RuntimeError:...checksum failed...). The same error was seen both when using nix-view and nixio to access the section.

What do you think happened there? Was it a nix issue or a sshfs issue?

Thanks.

Sincerely
Ajay

@jgrewe
Copy link
Member

jgrewe commented Aug 16, 2016

ok, actually the hdf5 lib can do it if a certain flag is set. https://hdfgroup.org/wp/2015/04/parallel-io-why-how-and-where-to-hdf5/
but we do not support it at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants