openPMD / openPMD/openPMD-api

loadChunk: zero extent

Open
#957 0 comments 0 reactions 0 assignees View on GitHub
affects latest release bug frontend: C++17 frontend: Python3 good first issue
Dominant language
C++
Stars
161
Forks
59
Avg merge
2d 22h
Merged PRs (30d)
7

Description

**Describe the bug**
Seen with #952: it should be allowed to load a zero-size extent.

```
corrupted double-linked list
```

This should produce an empty shared_ptr / zero-sized array (note that for numpy, only the `0:0` selected axes are set to zero-extent in the returned array).

**To Reproduce**

... having a hard time to write a reproducer outside of the location linked above..
https://github.com/ax3l/openPMD-api/tree/topic-zeroExtendRead
https://github.com/openPMD/openPMD-api/blob/f5dc8e25fcc26b3e78857e7cd30b6056a4b9255c/src/binding/python/openpmd_api/DaskArray.py#L39-L46

Python:
```python
import openpmd_api

# ...
data = rc[0:0]
rc.series_flush()
```
or C++
```C++
#include

// ...
```

**Expected behavior**
At the moment, this crashes (at least in Python). Instead, it should return a zero-sized variable/array.

**Software Environment**
- version of openPMD-api: 0.13.2
- installed openPMD-api via: from source
- operating system: Ubuntu 20.04
- machine: local laptop
- name and version of Python implementation: CPython 3.9.2
- version of HDF5: 1.10.6
- version of ADIOS1: N/A
- version of ADIOS2: 2.7.1
- name and version of MPI: N/A

**Additional context**
Seen with #952: This is used by Dask to "probe" the data set on initial access.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.