puzzling segfaults...

I'm working on a program whose purpose is to read text files and convert their data into a defined HDF format. In this case, the data set is of compound data types, rank 3, dimensions { 20160 1 512 }.

The program works by working with the data set in blocks of {8 1 512 }. It first reads the appropriate slice of the data set into a buffer (whose scope is the life of the program), then stores the data read from the text file into the appropriate spot in the slice. When a new slice is needed, the old one is written back out to disk before reading the new one.

The problem that I'm having is that it fails consistently near the end. One thought I had was that it was overstepping the bounds of the data set, but the failure is occurring while it's working with this:
H5Sselect_hyperslab start={ 18720 0 0 } stride={ 1 1 1 } count={ 1 1 1 } block={ 8 1 512 }

which is pretty obviously far from the extent of the matrix.

Another curiosity: if I run the program linked to 1.8.5, it simply segfaults in this spot. If I run it linked to 1.8.4-patch1, it segfaults in that spot, but the H5Dwrite call just before it fails with the following error:

HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
  #000: H5Dio.c line 266 in H5Dwrite(): can't write data
    major: Dataset
    minor: Write failed
  #001: H5Dio.c line 479 in H5D_write(): unable to set up type info
    major: Dataset
    minor: Unable to initialize object
  #002: H5Dio.c line 735 in H5D_typeinfo_init(): unable to convert between src and dest datatype
    major: Dataset
    minor: Feature is unsupported
  #003: H5T.c line 4425 in H5T_path_find(): no appropriate function for conversion path
    major: Datatype
    minor: Unable to initialize object

I added error checking (which was missing for some reason), and it still dumps core, though in a different place (without the error checking, it dumps core in H5FS_sect_find, with error checking, it dumps core in H5RS_decr while trying to close out the type ids).

I figure that given that it dumps core in the same spot in both library versions, I'm probably doing something wrong. On the flip side, it kind of looks like a memory overwrite is occurring somewhere.

In any case, I'm at a bit of a loss as to what the problem might be. Any suggestions as to what might be going on and how to fix it?

Thanks.

Never mind, it was a memory overwrite after all. Sorry to clutter the mailing list :slight_smile:

John Knutson wrote:

···

I'm working on a program whose purpose is to read text files and convert their data into a defined HDF format. In this case, the data set is of compound data types, rank 3, dimensions { 20160 1 512 }.

The program works by working with the data set in blocks of {8 1 512 }. It first reads the appropriate slice of the data set into a buffer (whose scope is the life of the program), then stores the data read from the text file into the appropriate spot in the slice. When a new slice is needed, the old one is written back out to disk before reading the new one.

The problem that I'm having is that it fails consistently near the end. One thought I had was that it was overstepping the bounds of the data set, but the failure is occurring while it's working with this:
H5Sselect_hyperslab start={ 18720 0 0 } stride={ 1 1 1 } count={ 1 1 1 } block={ 8 1 512 }

which is pretty obviously far from the extent of the matrix.

Another curiosity: if I run the program linked to 1.8.5, it simply segfaults in this spot. If I run it linked to 1.8.4-patch1, it segfaults in that spot, but the H5Dwrite call just before it fails with the following error:

HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
#000: H5Dio.c line 266 in H5Dwrite(): can't write data
   major: Dataset
   minor: Write failed
#001: H5Dio.c line 479 in H5D_write(): unable to set up type info
   major: Dataset
   minor: Unable to initialize object
#002: H5Dio.c line 735 in H5D_typeinfo_init(): unable to convert between src and dest datatype
   major: Dataset
   minor: Feature is unsupported
#003: H5T.c line 4425 in H5T_path_find(): no appropriate function for conversion path
   major: Datatype
   minor: Unable to initialize object

I added error checking (which was missing for some reason), and it still dumps core, though in a different place (without the error checking, it dumps core in H5FS_sect_find, with error checking, it dumps core in H5RS_decr while trying to close out the type ids).

I figure that given that it dumps core in the same spot in both library versions, I'm probably doing something wrong. On the flip side, it kind of looks like a memory overwrite is occurring somewhere.

In any case, I'm at a bit of a loss as to what the problem might be. Any suggestions as to what might be going on and how to fix it?

Thanks.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org