I have an HDF5 file containing some metadata. That file is, 99% of the time, only needed to be opened read-only. As such, I have a C++ class that wraps around the access for the metadata and opens the file read-only.
That 1% case, I have a program whose purpose is to update the metadata, and it needs to open the file read-write. The program that does the editing was using the read-only class for convenience, but it seems that things don't work like I was expecting.
If I have the class open the file read-only first, when I try and open it read-write, I get an error saying the file was already open for read-only. This isn't overly surprising, until I started closing the read-only handle before trying to open for read-write. At that point, I still got an error.
To make things clearer as to what I'm describing, here are some timelines:
open(RDONLY)
open(R-W) -> error
open(RDONLY)
close(RDONLY)
open(R-W) -> error (seems strange to me)
open(R-W)
open(RDONLY)
write(R-W) -> internal error, assertion failure. (seems like a bug, should've been an error)
Assertion failed: f->intent & ( 0x0001u), file H5Fio.c, line 154
I'm sure I can work around the issue, but I was hoping for an explanation of the last two conditions.