IntersectMBO / IntersectMBO/ouroboros-consensus

Catch any exceptions thrown during decoding data from disk

Open
#687 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
67
Forks
43
Avg merge
5d 13h
Merged PRs (30d)
43

Description

When any of the databases decode data from disk, they "graciously" handle failure (`fail`, `DeserialiseFailure`, `Left`, etc.). For example, the ImmutableDB and VolatileDB will truncate invalid blocks.

When a decoder throws an impure exception instead of a proper failure (`fail`), the exception is propagated instead of handled as "invalid data". When this happens while serving a request for a connection, the error policy will just restart the connection thread in question. However, when this happens on startup, e.g., during validation or recovery of the databases, the node will crash with that exception because the databases don't even get the chance to handle this invalid data. On the next startup(s), the same will happen unless the user intervenes.

Decoders should never throw impure exceptions, but bugs happen, see https://github.com/input-output-hk/cardano-base/pull/103.

We should catch such exceptions during decoding. Ideally this should be done in a central place, because it would be too easy to forget to do it in some decoder.

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.