Repository navigation
tests/hdf5: flush H5File before objectExists on unlink tests - #41
Merged
Merged
Conversation
The macOS Release CI builder of the master pipeline for #38 failed HDF5Test.UnlinkNestedObject: Value of: hdf5_utils::objectExists(ctx, filepath, "group/subgroup/data") Actual: false Expected: true The test creates a nested group/subgroup/data dataset, then calls objectExists() (which opens a *separate* H5File handle internally to do its check). On macOS Release the H5 library is free to keep the new dataset's metadata buffered against the original handle past the inner Group/DataSet release point, so the secondary handle observes a file in which the dataset does not yet exist and the assertion fails non-deterministically. Force a global flush after each create/unlink before calling objectExists(). Apply the same fix to the sibling HDF5Test.UnlinkDataSet for symmetry, since it has the exact same pattern and would race the same way under load.
transfix
added a commit
that referenced
this pull request
May 5, 2026
The HDF5Test fixture's temp dir was '/<binary_dir>/hdf5_test_<thread_id>'. Each ctest case is a separate process invocation but std::this_thread::get_id() for the main thread is frequently reused across freshly-spawned processes on macOS, so parallel ctest workers were colliding on the same on-disk directory and stomping each other's H5 files. That surfaced as flaky 'unknown file: Failure' / 'objectExists() == false' failures on test/macos-latest/Release for PR #42 even though the master baseline already includes the H5F_SCOPE_GLOBAL flush fix from #41. Make the directory name include the process id, an atomic per-process counter, and a steady_clock timestamp in addition to the thread id, so no two test instances (within or across processes) can collide. Wrap getpid() in a portable shim (process.h::_getpid on Windows, unistd.h::getpid elsewhere).
transfix
added a commit
that referenced
this pull request
May 5, 2026
The HDF5Test fixture's temp dir was '/<binary_dir>/hdf5_test_<thread_id>'. Each ctest case is a separate process invocation but std::this_thread::get_id() for the main thread is frequently reused across freshly-spawned processes on macOS, so parallel ctest workers were colliding on the same on-disk directory and stomping each other's H5 files. That surfaced as flaky 'unknown file: Failure' / 'objectExists() == false' failures on test/macos-latest/Release for PR #42 even though the master baseline already includes the H5F_SCOPE_GLOBAL flush fix from #41. Make the directory name include the process id, an atomic per-process counter, and a steady_clock timestamp in addition to the thread id, so no two test instances (within or across processes) can collide. Wrap getpid() in a portable shim (process.h::_getpid on Windows, unistd.h::getpid elsewhere).
transfix
added a commit
that referenced
this pull request
May 5, 2026
* test(state): replace file-scope test_ctx with per-test fixture Convert all 126 TEST() macros in state_test.cpp to TEST_F(StateTestFixture, ...). Each test now gets a fresh cvc::app, isolating per-test state roots instead of sharing the file-scope 'static cvc::app test_ctx;' crutch. - Add StateTestFixture with a per-test cvc::app ctx member. - Convert lambda bodies that reference ctx to capture 'this'. - Give the GuardedCallback helper struct an explicit cvc::app& reference so its operator() can reach the fixture's ctx. All 126 StateTestFixture cases pass locally (1 perf case skipped). * tests/hdf5: make per-test temp dir unique across parallel processes The HDF5Test fixture's temp dir was '/<binary_dir>/hdf5_test_<thread_id>'. Each ctest case is a separate process invocation but std::this_thread::get_id() for the main thread is frequently reused across freshly-spawned processes on macOS, so parallel ctest workers were colliding on the same on-disk directory and stomping each other's H5 files. That surfaced as flaky 'unknown file: Failure' / 'objectExists() == false' failures on test/macos-latest/Release for PR #42 even though the master baseline already includes the H5F_SCOPE_GLOBAL flush fix from #41. Make the directory name include the process id, an atomic per-process counter, and a steady_clock timestamp in addition to the thread id, so no two test instances (within or across processes) can collide. Wrap getpid() in a portable shim (process.h::_getpid on Windows, unistd.h::getpid elsewhere).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a non-deterministic CI failure of
HDF5Test.UnlinkNestedObjecton macOS Release that caused the master pipeline for #38 to go red.objectExists()opens a separateH5Filehandle internally; on macOS Release the H5 library is free to keep the freshly-created dataset's metadata buffered against the original write handle past the innerGroup/DataSetrelease point, so the secondary read handle sees a file without the new object.Force a global flush after each create/unlink before calling
objectExists(). Same fix applied to the siblingHDF5Test.UnlinkDataSetfor symmetry — it shares the exact same race pattern.Verified locally: 2/2 pass after the fix.