-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Describe the bug
The file samples/issue_sample/empty_alternate_fbpic.h5, as downloaded by our share/openPMD/download_samples.sh script, has the attribute /iterationEncoding set as "fileBased".
The current test accessing this file does nothing further than merely opening it (i.e. not anything requiring any actual later file accesses). I've extended the test by two simple lines, loading some data:
TEST_CASE( "empty_alternate_fbpic", "[serial][hdf5]" )
{
// Ref.: https://github.com/openPMD/openPMD-viewer/issues/296
try
{
{
Series s = Series("../samples/issue-sample/empty_alternate_fbpic.h5", Access::READ_ONLY);
REQUIRE(s.iterations.contains(50));
REQUIRE(s.iterations[50].particles.contains("electrons"));
REQUIRE(s.iterations[50].particles["electrons"].contains("momentum"));
REQUIRE(s.iterations[50].particles["electrons"]["momentum"].contains("x"));
auto empty_rc = s.iterations[50].particles["electrons"]["momentum"]["x"];
REQUIRE(empty_rc.empty());
REQUIRE(empty_rc.getDimensionality() == 1);
REQUIRE(empty_rc.getExtent() == Extent{0});
REQUIRE(isSame(empty_rc.getDatatype(), determineDatatype< double >()));
// THESE FOLLOWING TWO LINES TRIGGER AN ERROR
auto data =
s.iterations[ 50 ]
.meshes[ "B" ][ "r" ]
.loadChunk< double >( { 0, 0, 0 }, { 3, 50, 800 } );
s.flush();
}
{
Series list{ "../samples/issue-sample/empty_alternate_fbpic.h5", Access::READ_ONLY };
helper::listSeries( list );
}
} catch (no_such_file_error& e)
{
std::cerr << "issue sample not accessible. (" << e.what() << ")\n";
}
}Resulting output:
HDF5-DIAG: Error detected in HDF5 (1.10.4) thread 0:
#000: ../../../src/H5F.c line 509 in H5Fopen(): unable to open file
major: File accessibilty
minor: Unable to open file
#001: ../../../src/H5Fint.c line 1400 in H5F__open(): unable to open file
major: File accessibilty
minor: Unable to open file
#002: ../../../src/H5Fint.c line 1546 in H5F_open(): unable to open file: time = Mon Mar 22 15:39:44 2021
, name = '../samples/issue-sample/50.h5', tent_flags = 0
major: File accessibilty
minor: Unable to open file
#003: ../../../src/H5FD.c line 734 in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#004: ../../../src/H5FDsec2.c line 346 in H5FD_sec2_open(): unable to open file: name = '../samples/issue-sample/50.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0
major: File accessibilty
minor: Unable to open file
This shows that the openPMD API tried to open a file named ../samples/issue-sample/50.h5. It took the attribute iterationEncoding a bit too seriously and tried to piece the filename back together from the (default-initialized) prefix-padding-postfix.
Expected behavior
We should either consider the file faulty and fix it or alternatively fix the flushing procedures.
Software Environment
- version of openPMD-api: current dev (15a98c7)
- machine irrelevant
Additional context
I triggered the issue in this PR and applied a hotfix there. Don't know if it is the best fix. Maybe we should split the iterationEncoding into an internal and an external one?