Skip to content

RecordComponent Constant After Store #476

Open
@ax3l

Description

@ax3l

Describe the bug
Setting (accidentally) storeChunk and then makeConstant on the same RecordComponent before a flush does not throw a user-friendly error (nor is it gracefully handled).

Instead, a backend-error is thrown on flush, which even leads to an unhandled crash in case of HDF5.

To Reproduce

Python:

import openpmd_api

# ...

or C++

#include <openPMD/openPMD.hpp>

// example: data handling
#include <numeric>  // std::iota
#include <vector>   // std::vector

namespace api = openPMD;


int main()
{

auto series = api::Series(
    "myOutput/data_%05T.bp",
    api::AccessType::CREATE);

auto i = series.iterations[42];
    
std::vector<float> x_data(
    150 * 300);
std::iota(
    x_data.begin(),
    x_data.end(),
    0.);

float x2_data = 4.f;
    
// record
auto B = i.meshes["B"];

// record components
auto B_x = B["x"];

auto dataset = api::Dataset(
    api::determineDatatype<float>(),
    {150, 300});
B_x.resetDataset(dataset);

B_x.storeChunk(
    api::shareRaw(x_data),
    {0, 0}, {150, 300});

B_x.makeConstant(y_data);

series.flush();

return 0;
}

JSON:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Specified dataset does not exist or is not a dataset.
Aborted

HDF5: (not even catched by IO backend)

HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) thread 0:
  #000: ../../../src/H5D.c line 296 in H5Dopen2(): unable to open dataset
    major: Dataset
    minor: Can't open object
  #001: ../../../src/H5Dint.c line 1470 in H5D__open_name(): not a dataset
    major: Dataset
    minor: Inappropriate type
terminate called after throwing an instance of 'std::runtime_error'
  what():  Internal error: Failed to open HDF5 dataset during dataset write
Aborted

Expected behavior
A clear and concise description of what you expected to happen.

Software Environment:

  • version of openPMD-api: 0.8.0-dev
  • installed openPMD-api via: from source
  • operating system: Linux Debian
  • machine: local laptop
  • name and version of Python implementation: CPython 3.6.7
  • version of HDF5: 1.10.0-patch1
  • version of ADIOS1: none
  • name and version of MPI: OpenMPI 2.0.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions