openPMD / openPMD-api

:floppy_disk: C++ & Python API for Scientific I/O
https://openpmd-api.readthedocs.io
GNU Lesser General Public License v3.0
134 stars 51 forks source link

Don't allow Container insertion in READ_LINEAR #1590

Closed franzpoeschel closed 5 months ago

franzpoeschel commented 5 months ago

Container<T>::operator[]() currently only checks if the access type is READ_ONLY, but insertion should also be disallowed in READ_LINEAR mode.

While debugging this, I noticed that the IO queue was not cleared when encountering exceptions. In order to allow clean destruction, this PR also drains the IO queue in such a case. Potential future todo: Don't modify the data structures until a flush was successful, so the operation can be repeated. For now, this allows clean destruction and avoids segfaults.