Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing logic: fail gracefully on unexpected input #1237

Merged
merged 17 commits into from
Jan 4, 2023

Conversation

franzpoeschel
Copy link
Contributor

@franzpoeschel franzpoeschel commented Mar 25, 2022

Reading failures should ideally affect only the innermost scope possible. When one record component fails parsing due to whatever error, the neighboring record components should remain readable. When one iteration fails parsing, skip it and go on to the next.
Current behavior: Parsing fails and the Series cannot be opened

Close #983

TODO

  • Introduce ReadError error type that backends can throw to tell the frontend about recoverable failures
  • Throw ReadError inside ADIOS1 and ADIOS2 attribute reading routines
  • Frontend: Recover from ReadErrors (partially implemented so far)
  • Other backends, also consider dataset reading, ... UPDATE: Catching wrong attribute reads now possible in all backends, dataset reading and further things can come in a later update
  • Testing: file-based, group-based, varialbe-based, deferred/eager, opening single iterations of a file-based series, streaming API, skipping iteration
  • Merge Mapping between ADIOS steps and openPMD iterations #949 first to avoid merge conflicts
  • Correctly recover from deferred actions in ADIOS2
  • ADIOS2 / variable-based encoding: Backend reports wrong value for snapshot in iteration 10
  • bp4_steps test seems to not write snapshot attribute only written in new ADIOS2 schema as it should be
  • Avoid const_cast by using the parsing state

This whole PR is a bit of a stretch-goal as there are many different types and sources of errors to be recovered from.
@ax3l Can you name some specific error pattern (or even give me a test file) that the openPMD-api should handle more robustly?

I think that a backend failure should mean that the entire call to AbstractIOHandler::flush() has failed and the queue is cleared. For finer granularity error handling, the frontend must issue single flush() calls. So, I've changed error recovery procedures to clear the entire IO queue upon failure.

std::cerr << "WARNING: Skipping invalid openPMD record '"
<< record_name << "'" << std::endl;
while (!IOHandler()->m_work.empty())
IOHandler()->m_work.pop();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to clear the queue here anymore, it's already cleared by AbstractIOHandler::flush() upon failure

@franzpoeschel franzpoeschel force-pushed the topic-read-leniently branch 2 times, most recently from 5a5275f to 83dd2ad Compare March 29, 2022 09:17
@franzpoeschel franzpoeschel marked this pull request as draft March 29, 2022 15:10
@@ -327,26 +336,6 @@ void Iteration::deferParseAccess(DeferredParseAccess dr)
std::make_optional<DeferredParseAccess>(std::move(dr));
}

void Iteration::read()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged this with runDeferredParseAccess, no reason to keep them separate.

{
*newType = oldType;
throw;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style of try-catch-block is necessary if we want to keep the Series usable after throwing an exception. If we want to avoid this, we must find a way to parse without changing that state.

@franzpoeschel franzpoeschel marked this pull request as ready for review March 30, 2022 12:52
@franzpoeschel
Copy link
Contributor Author

(not actually ready for review, just wanting to run the CI)

@franzpoeschel franzpoeschel force-pushed the topic-read-leniently branch 2 times, most recently from 8886071 to 1a6b89c Compare March 30, 2022 13:49
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Mar 31, 2022

This pull request introduces 1 alert when merging 1985a70 into 3c57afb - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

src/IO/HDF5/HDF5IOHandler.cpp Outdated Show resolved Hide resolved
src/IO/HDF5/HDF5IOHandler.cpp Outdated Show resolved Hide resolved
src/IO/HDF5/HDF5IOHandler.cpp Outdated Show resolved Hide resolved
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Apr 1, 2022

This pull request introduces 1 alert when merging e4e00b3 into 8b4a58a - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@ax3l
Copy link
Member

ax3l commented Apr 1, 2022

Can you name some specific error pattern (or even give me a test file) that the openPMD-api should handle more robustly?

The most important pattern I have it reading a series (any encoding) from a sim that is currently running. The latest time step is usually incomplete.
I think we could create test files by aborting sims mid-dump somehow...?

@franzpoeschel franzpoeschel force-pushed the topic-read-leniently branch 2 times, most recently from ec9defd to 91eed89 Compare April 5, 2022 10:45
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Apr 5, 2022

This pull request introduces 1 alert when merging 91eed89 into 29bb474 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@franzpoeschel franzpoeschel force-pushed the topic-read-leniently branch from 91eed89 to 0213774 Compare April 5, 2022 15:47
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Apr 5, 2022

This pull request introduces 1 alert when merging 124b923 into 29bb474 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@franzpoeschel franzpoeschel force-pushed the topic-read-leniently branch from 124b923 to 2397323 Compare April 8, 2022 10:04
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Apr 8, 2022

This pull request introduces 1 alert when merging 47ec995 into 9c4173a - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@franzpoeschel franzpoeschel force-pushed the topic-read-leniently branch from 47ec995 to 20e1cf4 Compare April 8, 2022 11:24
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Apr 8, 2022

This pull request introduces 1 alert when merging b64988f into 9c4173a - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@ax3l ax3l closed this Apr 15, 2022
@ax3l ax3l reopened this Apr 15, 2022
@ax3l ax3l self-assigned this Dec 8, 2022
@ax3l
Copy link
Member

ax3l commented Dec 19, 2022

Thanks a lot!

I did a first test reading partially written simulation data, i.e., the /openPMD attribute is not yet written for each iteration. I tested it in fileBased encoding. Currently, incomplete iterations (snapshots) are not yet leniently skipped:

openpmd-ls ~/src/warpx/build/bin/diags/diag_btd/openpmd_%T.bp
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
[~ADIOS2IOHandler] An error occurred: [ADIOS2] Requested attribute (/openPMD) not found in backend.
An error occurred while opening the specified openPMD series!
[ADIOS2] Requested attribute (/openPMD) not found in backend.

partial_btd.tar.gz

@franzpoeschel
Copy link
Contributor Author

franzpoeschel commented Dec 19, 2022

This is the output that I get upon openpmd-ls openpmd_%T.bp with your dataset:

[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '0' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '1' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '2' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '3' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '4' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '5' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '6' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '7' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '8' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '9' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '10' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '11' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '12' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '13' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '14' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '15' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '16' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '17' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '18' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '19' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '20' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '21' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '22' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '23' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '24' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '25' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '26' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '27' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '28' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '29' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '30' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '31' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '32' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '33' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '34' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '35' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '36' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '37' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '38' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '39' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '40' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '41' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '42' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '43' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '44' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '45' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '46' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '47' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '48' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '49' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '50' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '51' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '52' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '53' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '54' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '55' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '56' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '57' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '58' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '59' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '60' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '61' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '62' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '63' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '64' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '65' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '66' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '67' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '68' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '69' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '70' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '71' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '72' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '73' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '74' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '75' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '76' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '77' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '78' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '79' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '80' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '81' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '82' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '83' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '84' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '85' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '86' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '87' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '88' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '89' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '90' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '91' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '92' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '93' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '94' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '95' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '96' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '97' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '98' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[ADIOS2] Warning: Attribute with name /openPMD has no type in backend.
Cannot read iteration '99' and will skip it due to read error:
Read Error in backend ADIOS2
Object type:	Attribute
Error type:	NotFound
Further description:	/openPMD
[fwk394:1588514:0:1588514] Caught signal 11 (Segmentation fault: address not mapped to object at address 0x6)
==== backtrace (tid:1588514) ====
 0 0x000000000003dbf0 __GI___sigaction()  ???:0
 1 0x000000000046559c std::__1::__sort<openPMD::ADIOS2IOHandlerImpl::~ADIOS2IOHandlerImpl()::$_2&, std::__1::unique_ptr<openPMD::detail::BufferedActions, std::__1::default_delete<openPMD::detail::BufferedActions> >*>()  ADIOS2IOHandler.cpp:0
 2 0x0000000000465475 std::__1::__sort<openPMD::ADIOS2IOHandlerImpl::~ADIOS2IOHandlerImpl()::$_2&, std::__1::unique_ptr<openPMD::detail::BufferedActions, std::__1::default_delete<openPMD::detail::BufferedActions> >*>()  ADIOS2IOHandler.cpp:0
 3 0x0000000000465475 std::__1::__sort<openPMD::ADIOS2IOHandlerImpl::~ADIOS2IOHandlerImpl()::$_2&, std::__1::unique_ptr<openPMD::detail::BufferedActions, std::__1::default_delete<openPMD::detail::BufferedActions> >*>()  ADIOS2IOHandler.cpp:0
 4 0x000000000045202e openPMD::ADIOS2IOHandlerImpl::~ADIOS2IOHandlerImpl()  ???:0
 5 0x000000000046fc76 openPMD::ADIOS2IOHandler::~ADIOS2IOHandler()  ???:0
 6 0x000000000046fde9 openPMD::ADIOS2IOHandler::~ADIOS2IOHandler()  ???:0
 7 0x00000000002f2cce openPMD::internal::SeriesData::close()  ???:0
 8 0x00000000002f282e openPMD::internal::SeriesData::~SeriesData()  ???:0
 9 0x00000000002f2d69 openPMD::internal::SeriesData::~SeriesData()  ???:0
10 0x0000000000287bd5 openPMD::Attributable::~Attributable()  ???:0
11 0x00000000002f3e2b openPMD::Series::Series()  ???:0
12 0x00000000000c7a0e pybind11::error_already_set::m_fetched_error_deleter()  ???:0
13 0x000000000002f95a pybind11::error_already_set::m_fetched_error_deleter()  ???:0
14 0x0000000000129fc3 cfunction_call()  ???:0
15 0x00000000000bcc84 _PyObject_MakeTpCall.localalias()  ???:0
16 0x000000000006f41c _PyEval_EvalFrameDefault()  ???:0
17 0x00000000001eb2cf _PyEval_Vector()  ???:0
18 0x000000000006d68f _PyEval_EvalFrameDefault()  ???:0
19 0x00000000001eb2cf _PyEval_Vector()  ???:0
20 0x00000000001eb938 PyEval_EvalCode()  ???:0
21 0x000000000026f8ad run_mod()  ???:0
22 0x000000000027c382 _PyRun_SimpleFileObject.localalias()  ???:0
23 0x000000000027c95b _PyRun_AnyFileObject()  ???:0
24 0x0000000000280a1f Py_RunMain.localalias()  ???:0
25 0x0000000000281245 Py_BytesMain()  ???:0
26 0x000000000002924e __libc_start_call_main()  ???:0
27 0x0000000000029309 __libc_start_main_alias_2()  ???:0
28 0x0000000000401075 _start()  ???:0
=================================

Weirdly enough, the segfault only appears when redirecting stderr into a file....

update: we use std::stable_sort not in the destructor, even though there are no duplicate files.

src/ParticleSpecies.cpp Fixed Show resolved Hide resolved
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!
Added inline comments :)

@@ -909,6 +907,7 @@ if(openPMD_USE_INVASIVE_TESTS)
message(WARNING "Invasive tests that redefine class signatures are "
"known to fail on Windows!")
endif()
target_compile_definitions(openPMD PRIVATE openPMD_USE_INVASIVE_TESTS=1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This macro should never be shipped. It introduces UB and is only used in some testing.

Suggested change
target_compile_definitions(openPMD PRIVATE openPMD_USE_INVASIVE_TESTS=1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macro is still activated only in those special tests and not shipped (see the if(openPMD_USE_INVASIVE_TESTS) above). I need this macro inside Iteration.cpp in here:

#ifdef openPMD_USE_INVASIVE_TESTS

This is the most reliable way to trigger errors to be thrown.

Are there workflows where users compile openPMD with openPMD_USE_INVASIVE_TESTS and still install the resulting compiled library? If yes, are there better ways to do this then?
Just removing this line breaks the parsing test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see.
ok, extents its meaning but is ok.

src/IO/ADIOS/ADIOS2IOHandler.cpp Outdated Show resolved Hide resolved
src/ParticleSpecies.cpp Fixed Show resolved Hide resolved
src/RecordComponent.cpp Outdated Show resolved Hide resolved
src/Series.cpp Outdated Show resolved Hide resolved
Some weird compiler configurations don't understand error type symbols
across libraries, so keep the symbols entirely to the main library.
This is the commit with the most complicated logic changes.
It implements skipping broken iterations at the Series level.
This includes the Streaming API (Series::readIterations()), as well as
our three iteration encodings.

On the positive side: The most complex logic changes have already been
prepared in the topic-adios2-append PR
Nothing too complicated, just tedious
`using no_such_file_error = error::ReadError` for backwards
compatibility in user code.
@todo: Check if this needs to be done elsewhere
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 ✨

@ax3l ax3l merged commit 599ac5a into openPMD:dev Jan 4, 2023
@ax3l ax3l added this to the 0.15.0 milestone Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reading: Improved Error Handling
2 participants