-
Notifications
You must be signed in to change notification settings - Fork 264
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
Segfault if reading file while wrinting #862
Comments
The netcdf-c library is not yet thread safe, but it is a high priority for the dev team. See #844. |
Sorry for the unclear language. It might be related to #813, however. |
I don't think you can read from a file that is being written to at the same time. |
I am perfectly happy not being able to read it. |
Python can't catch the error since the segfault is happening in the C library. It looks as if HDF5 1.10 at least make this possible (https://support.hdfgroup.org/HDF5/docNewFeatures/NewFeaturesSwmrDocs.html) |
So should I report this segfault to netcdf? |
Wouldn't hurt - but I suspect the issue is that since there is currently no file-locking mechanism in the library there is no way to prevent data (and memory) corruption when you attempt to read and write to the same file at the same time. Segfaults are inevitable as a result, until the SWMR features of HDF5 are enabled in netcdf-c. If you are using NETCDF3, opening the files with NC_SHARE might avoid this (mode='s'). According the docs for nc_open: "The NC_SHARE flag is only used for netCDF classic and 64-bit offset files. It is appropriate when one process may be writing the dataset and one or more other processes reading the dataset concurrently; it means that dataset accesses are not buffered and caching is limited. Since the buffering scheme is optimized for sequential access, programs that do not access data sequentially may see some performance improvement by setting the NC_SHARE flag." |
closing now |
I am writing a file in one process. If I try to read it in a second thread I get the attached segmentation fault.
I am trying to read a file, while it is being written on a different node.
I could not reproduce this on a single machine - so maybe the locking mechanism fails if different computer are involved?
The text was updated successfully, but these errors were encountered: