Change in the way strong file closure works?

NOTE: The netcdf-hdf mailing list is no longer active. The list archives are made available for historical reasons.

Howdy all!

This morning I did a hdf5 update, and now the following code does not
work, though it did before.

The problem seems to be related to closing the file. I call for strong
file closure, but the close fails anyway. The error output is below.

What am I missing here?

Thanks!

Ed

int
main()
{
   hid_t fileid, access_plist, spaceid, typeid;
   hid_t datasetid;
   hsize_t dims[1];
   struct s1 {
         unsigned char c1;
         double d;
   } data[DIM1_LEN];
   int i;

   for (i=0; i<DIM1_LEN; i++)
   {
      data[i].c1 = 126;
      data[i].d = -9999999;
   }

   printf("*** Checking packing of HDF5 compound types...");
   
   /* Open file and create group. */
   if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
   if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
   if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, 
                           access_plist)) < 0) ERR;

   /* Create a simple compound type. */
   if ((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) ERR;
   if (H5Tinsert(typeid, "c1", HOFFSET(struct s1, c1), H5T_NATIVE_UCHAR) < 0) 
ERR;
   if (H5Tinsert(typeid, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) 
ERR;
   if (H5Tcommit(fileid, COMPOUND_NAME, typeid) < 0) ERR;

   /* Create a space. */
   dims[0] = DIM1_LEN;
   if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;

   /* Create a dataset of this compound type. */
   if ((datasetid = H5Dcreate(fileid, VAR_NAME, typeid, spaceid, 
                              H5P_DEFAULT)) < 0) ERR;

   /* Write some data. */
   if (H5Dwrite(datasetid, typeid, H5S_ALL, H5S_ALL, 
                H5P_DEFAULT, data) < 0) ERR;

   /* Release all resources. */
   if (H5Fclose(fileid) < 0) ERR;


This code results in the following error:

HDF5-DIAG: Error detected in HDF5 (1.7.51) thread 0:
  #000: H5F.c line 2788 in H5Fclose(): decrementing file ID failed
    major: Object atom
    minor: Unable to close file
  #001: H5F.c line 2577 in H5F_close(): can't close file
    major: File accessability
    minor: Unable to close file
  #002: H5F.c line 2686 in H5F_try_close(): can't close object
    major: Object atom
    minor: Close failed
  #003: H5I.c line 1340 in H5I_dec_ref(): can't locate ID
    major: Object atom
    minor: Unable to find atom information (already closed?)
  #004: H5I.c line 1893 in H5I_search(): invalid type
    major: Object atom
    minor: Unable to find ID group information


-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx


  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-hdf archives: