Error "can't synchronously write data" after H5Dwrite

In the method which does the output, i prepare the datatype for the compound data i want to write, together with a DataSpace and a DataSet, then i do

  status = H5Sselect_hyperslab(hDataSpace, H5S_SELECT_SET, 
                                         &offset, &stride, &count, &block);
        
  status = H5Dwrite(hDataSet, hAgentType, hMemSpace,
                               hDataSpace, H5P_DEFAULT, pSlab);

I have 20 elements i want to write. I set hMemSpace = H5Screate_simple (1, &dimsm, NULL);. In the call to H5Sselect_hyperslab()??,offsetis 0,strideis 1,count`` is 20 and block is 1.

But the call to H5Dwrite() causes the following output on stderr:

HDF5-DIAG: Error detected in HDF5 (1.14.1) thread 0:
   #000: H5D.c line 1390 in H5Dwrite(): can't synchronously write data
    major: Dataset
    minor: Write failed
  #001: H5D.c line 1333 in H5D__write_api_common(): can't write data
    major: Dataset
    minor: Write failed
  #002: H5VLcallback.c line 2282 in H5VL_dataset_write_direct(): dataset write failed
    major: Virtual Object Layer
    minor: Write failed
  #003: H5VLcallback.c line 2237 in H5VL__dataset_write(): dataset write failed
    major: Virtual Object Layer
    minor: Write failed
  #004: H5VLnative_dataset.c line 401 in H5VL__native_dataset_write(): unable to set up file and memory dataspaces
    major: Dataset
    minor: Unable to initialize object
  #005: H5VLnative_dataset.c line 175 in H5VL__native_dataset_io_setup(): selection + offset not within extent for file dataspace
    major: Dataspace
    minor: Out of range

I have no idea what could cause a “synchronously written data” in #000 - this section is not called in a parallelized section of my code.
Also, i don’t exactly see where a range problem could occur.

Is there a procedure with which i can gain more knowledge about the cause of these errors?

Hi @jody.xha,

I have no idea what could cause a “synchronously written data” in #000

In this case, this is just signifying that the H5Dwrite API routine was called rather than H5Dwrite_async.

As for the error you’re running into, the message “selection + offset not within extent for file dataspace” means that the selection that was made on the file dataspace used for writing to the dataset falls outside the valid bounds for the dataspace. For example, here’s a minimal example where the count parameter provided for H5Sselect_hyperslab is [ 5, 4 ], whereas the dataspace was created with a dimensionality of [ 4, 4 ]. This will trigger the same issue.
example.c (780 Bytes)

Do you happen to have a minimal example that shows the issue? I’d double-check to make sure that the variables you’re passing for the “start”, “stride”, “count” and “block” parameters to H5Sselect_hyperslab didn’t get accidentally overwritten somewhere and that the combination of the four match up with the size of the file dataspace that was created. Also, it may be less obvious when there’s a range issue if you pass something other than NULL or an array of 1s for the “block” parameter.