Closed MarkRivers closed 3 years ago
I have reproduced this error. It only occurs for "constant" string datasets, not for string datasets that are created from NDArray string attributes. The latter are always created with a size of MAX_ATTRIBUTE_STRING_SIZE=256.
The following line in the HDF5 layout XML file will generate the error message:
<dataset name="det_name" source="constant" value="" type="string" when="OnFileOpen">
The error message is:
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 139977620715264:
#000: ../H5T.c line 2153 in H5Tset_size(): size must be positive
major: Invalid arguments to routine
minor: Bad value
It only occurs for "constant" string datasets
What is the context of constant here? Is there an example in the code?
Sorry, my previous comment illustrated what I meant by "constant", but did not show up correctly because I did not escape the <dataset ...
code. I have edited the comment to fix that. So it happens for datasets with source=constant
and value=""
, i.e. a zero length string. I believe it would also happen for zero length HDF5 attributes, but I don't have an easy way to create those without modifying the code.
I have created PR #461 to fix this issue.
Closed via #461
The following error message was reported when using ADCore R3-9.
H5Tset_size()
is called 3 times in NDFileHDF5.cpp:So it is passing the actual length of the string, either from std::string.size() or strlen(). However, the documentation for the H5Tset_size() functions says this:
Note that the datatype we are creating is H5T_C_S1 which is a C string. The documentation says that we should be passing a size that includes space for the null-terminator character, but we are not. This would explain the error message above.
This seems like a bug that should be fixed, but it will result in HDF5 files that are different from the ones we have been producing.