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

Weird attribute caching bug brings values back from the dead #1182

Open
david-macmahon opened this issue Dec 9, 2024 · 0 comments
Open

Weird attribute caching bug brings values back from the dead #1182

david-macmahon opened this issue Dec 9, 2024 · 0 comments

Comments

@david-macmahon
Copy link
Contributor

Using HDF5.jl v0.17.2, attributes seem to have some weird caching problem that brings old values back from the dead. To recreate:

  1. Create/set an attribute to one value
  2. Delete the attribute
  3. Create/set the same attribute to a different value
  4. Reading the attribute value returns the originally written value, not the new value
  5. Closing and re-opening the file and re-reading the attribute gets the new value
julia> h5 = h5open("test.h5", "w")
🗂️ HDF5.File: (read-write) test.h5

julia> h5["data"] = rand(4,3);

julia> h5["data"]["attr"] = "foo"
"foo"

julia> h5
🗂️ HDF5.File: (read-write) test.h5
└─ 🔢 data
   └─ 🏷️ attr

julia> h5["data"]["attr"][]
"foo"

julia> delete_attribute(h5["data"], "attr")

julia> h5
🗂️ HDF5.File: (read-write) test.h5
└─ 🔢 data

julia> h5["data"]["attr"][]
ERROR: KeyError: key "attr" not found
Stacktrace:
 [1] getindex(dset::HDF5.Dataset, name::String)
   @ HDF5 ~/.julia/packages/HDF5/Z859u/src/attributes.jl:403
 [2] top-level scope
   @ REPL[119]:1

julia> h5["data"]["attr"] = "bar"
"bar"

julia> h5["data"]["attr"][] # Should return "bar"!!!
"foo"

julia> close(h5)

julia> h5 = h5open("test.h5")
🗂️ HDF5.File: (read-only) test.h5
└─ 🔢 data
   └─ 🏷️ attr

julia> h5["data"]["attr"][]
"bar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant