[Bug] Attribute creation index can't be incremented

To reproduce:

1) Compile attached minimal test.c

2) Run it. The following output is returned:

Creating "test.h5"... done.
Creating one attribute... done.
Creating/deleting other attribute...
Iteration 0... done.
Iteration 1... done.
Iteration 2... done.
[skip]
Iteration 65533... done.
Iteration 65534... HDF5-DIAG: Error detected in HDF5 (1.8.14) thread 0:
   #000: E:\hdf-build\hdf5-1.8.14\src\H5A.c line 259 in H5Acreate2(): unable to create attribute
     major: Attribute
     minor: Unable to initialize object
   #001: E:\hdf-build\hdf5-1.8.14\src\H5Aint.c line 275 in H5A_create(): unable to create attribute in object header
     major: Attribute
     minor: Unable to insert object
   #002: E:\hdf-build\hdf5-1.8.14\src\H5Oattribute.c line 310 in H5O_attr_create(): attribute creation index can't be incremented
     major: Attribute
     minor: Unable to increment reference count
error!

Reproducible for HDF5 1.8.14 on Windows.

The problem is not reproducible if the following line is commented out (program finishes normally):

   H5Pset_attr_creation_order(cprops_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);

Ready to provide any additional info,
Andrey Paramonov

test.c (1.23 KB)

···

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Hi Andrei,

You are definitely driving HDF5 to its limits :slight_smile:

HDF5 has a limitation on the index value for the attributes (2 bytes); see attribute info message<http://www.hdfgroup.org/HDF5/doc/H5.format.html#AinfoMessage> in the HDF5 File Format Specification.

Nevertheless, I think it is a bug and we will need to address it. May be you’ve already noticed that the file becomes corrupted. I entered an issue into our JIRA DB HDFFV-9281.

All,

Is there a good reason to have more than 65533 attributes on an object? If so, we will need to change HDF5 files format.

Thank you!

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Apr 10, 2015, at 5:42 AM, Андрей Парамонов <paramon@acdlabs.ru<mailto:paramon@acdlabs.ru>> wrote:

To reproduce:

1) Compile attached minimal test.c

2) Run it. The following output is returned:

Creating "test.h5"... done.
Creating one attribute... done.
Creating/deleting other attribute...
Iteration 0... done.
Iteration 1... done.
Iteration 2... done.
[skip]
Iteration 65533... done.
Iteration 65534... HDF5-DIAG: Error detected in HDF5 (1.8.14) thread 0:
#000: E:\hdf-build\hdf5-1.8.14\src\H5A.c line 259 in H5Acreate2(): unable to create attribute
   major: Attribute
   minor: Unable to initialize object
#001: E:\hdf-build\hdf5-1.8.14\src\H5Aint.c line 275 in H5A_create(): unable to create attribute in object header
   major: Attribute
   minor: Unable to insert object
#002: E:\hdf-build\hdf5-1.8.14\src\H5Oattribute.c line 310 in H5O_attr_create(): attribute creation index can't be incremented
   major: Attribute
   minor: Unable to increment reference count
error!

Reproducible for HDF5 1.8.14 on Windows.

The problem is not reproducible if the following line is commented out (program finishes normally):

H5Pset_attr_creation_order(cprops_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);

Ready to provide any additional info,
Andrey Paramonov

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

<test.c>_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Hello Elena, thank you for your reply!

15.04.2015 5:49, Elena Pourmal пишет:

Hi Andrei,

You are definitely driving HDF5 to its limits :slight_smile:

HDF5 has a limitation on the index value for the attributes (2 bytes);
see attribute info message
<http://www.hdfgroup.org/HDF5/doc/H5.format.html#AinfoMessage> in the
HDF5 File Format Specification.

Nevertheless, I think it is a bug and we will need to address it. May be
you’ve already noticed that the file becomes corrupted. I entered an
issue into our JIRA DB HDFFV-9281.

All,

Is there a good reason to have more than 65533 attributes on an object?
If so, we will need to change HDF5 files format.

I agree that having 65533 attributes is crazy :slight_smile:

However if you look at the code you will see that the file has at most 2 attributes at a time (note the call to H5Adelete).

I was able to circumvent the problem in my client code, but it's still unexpected that index value grows unlimited in this case. Would be good to have it fixed someday.

Best wishes,
Andrey Paramonov

···

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Hi Andrey,

Hello Elena, thank you for your reply!

15.04.2015 5:49, Elena Pourmal пишет:

Hi Andrei,

You are definitely driving HDF5 to its limits :slight_smile:

HDF5 has a limitation on the index value for the attributes (2 bytes);
see attribute info message
<http://www.hdfgroup.org/HDF5/doc/H5.format.html#AinfoMessage> in the
HDF5 File Format Specification.

Nevertheless, I think it is a bug and we will need to address it. May be
you’ve already noticed that the file becomes corrupted. I entered an
issue into our JIRA DB HDFFV-9281.

All,

Is there a good reason to have more than 65533 attributes on an object?
If so, we will need to change HDF5 files format.

I agree that having 65533 attributes is crazy :slight_smile:

However if you look at the code you will see that the file has at most 2 attributes at a time (note the call to H5Adelete).

Yes, this is true. The file has only two attributes, but right now, the library doesn’t “reuse” the index, so attribute creation index is growing. We will definitely look into the issue.

I was able to circumvent the problem in my client code, but it's still unexpected that index value grows unlimited in this case. Would be good to have it fixed someday.

Agree.

Thanks again for reporting a nice bug :slight_smile:

Elena

···

On Apr 15, 2015, at 3:10 AM, Андрей Парамонов <paramon@acdlabs.ru> wrote:

Best wishes,
Andrey Paramonov

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5