Skip to content

Conversation

@jorisdral
Copy link
Collaborator

@jorisdral jorisdral commented Feb 20, 2025

This PR adds

  • Functionality to log errors injected by fs-sim
  • Assertions in the state machine to check that always see disk errors if we inject noisy errors through fs-sim. That is, the assertion checks that no noisy errors are swallowed.
  • Finally, we add and test a dynamic logic (DL) formula that injects errors into all lsm-tree actions and runs the swallow error assertion afterwards.

@jorisdral jorisdral self-assigned this Feb 20, 2025
@jorisdral jorisdral changed the base branch from main to jdral/all-actions-get-errors February 20, 2025 19:25
@jorisdral jorisdral force-pushed the jdral/all-actions-get-errors branch from c604654 to cea8219 Compare February 21, 2025 10:12
@jorisdral jorisdral force-pushed the jdral/swallowed-exceptions branch 3 times, most recently from 9354949 to 72f7383 Compare February 21, 2025 15:47
@jorisdral jorisdral force-pushed the jdral/all-actions-get-errors branch 2 times, most recently from 6ac95c6 to 7c84a2a Compare February 24, 2025 12:09
@jorisdral jorisdral force-pushed the jdral/swallowed-exceptions branch from 72f7383 to ba32682 Compare February 25, 2025 09:51
@jorisdral jorisdral marked this pull request as ready for review February 25, 2025 09:52
@jorisdral
Copy link
Collaborator Author

BTW, this PR depends on #578 being reviewed and merged first.

@jorisdral jorisdral force-pushed the jdral/all-actions-get-errors branch from 7c84a2a to 0969c5a Compare March 3, 2025 10:28
@jorisdral jorisdral force-pushed the jdral/swallowed-exceptions branch from ba32682 to 6243344 Compare March 3, 2025 13:23
Base automatically changed from jdral/all-actions-get-errors to main March 4, 2025 23:33
@jorisdral jorisdral force-pushed the jdral/swallowed-exceptions branch from 6a3249b to 3e074a6 Compare March 5, 2025 11:28
Copy link
Collaborator

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

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

This is looking very good.

-- restrictive, but this automatically improves as we make more actions
-- exceptions safe. When we generate injected errors for these errors by default
-- (in @arbitraryWithVars@), the swallowed exception assertion automatically
-- runs for those actions as well.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the motivation behind only running the action with a definite error last?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's mentioned in the text above this TODO: database behaviour should be considered undefined after an exception is thrown in exception unsafe code. If we run more actions afterwards, the SUT and model are almost certainly going to disagree on their responses

@dcoutts
Copy link
Collaborator

dcoutts commented Mar 5, 2025

#607 is now in the merge queue, so this can be rebased on that.

@jorisdral jorisdral force-pushed the jdral/swallowed-exceptions branch 4 times, most recently from f60ace5 to ff129e7 Compare March 10, 2025 16:39
Copy link
Collaborator

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

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

The changes based on review feedback look good.

Squash the fixups and merge! 😄

We will be testing that `lsm-tree` operations do not swallow errors by injecting
errors into the simulated file system and checking after the fact whether we
should have seen an exception or not. One way to check this would be to compare
the `Errors` structure before and after the `lsm-tree` operations, but this is
unfortunately not possible in general. `Errors` are potentially infinite
structures, which means computing a comparison on `Errors` may diverge. Instead,
what we do is we create an `ErrorsLog` structure that records errors as soon as
they are injected. We can inspect this log to see if any errors were swallowed.
When we start testing that errors are not swallowed by `lsm-tree`, we'll be
injecting errors into bits of code that are not exception safe (yet). As a
result, the checks mentioned in the commit title would lead to property
failures. However, we just want to test that errors are not swallowed, so we
make these checks configurable. File system checks, cleanup checks, and
reference checks can enabled/disabled independently.
This property runs a sequence of state machine actions where the last action
definitely injects errors, at which point we can check if no errors are
swallowed. See the documentation of `prop_noSwallowedExceptions` for more
information. The property is currently expected to fail.
We replace the assertions by pure responses that are checked against the model.
@jorisdral jorisdral force-pushed the jdral/swallowed-exceptions branch from ff129e7 to 4e62a8a Compare March 11, 2025 09:29
@jorisdral jorisdral enabled auto-merge March 11, 2025 09:29
@jorisdral jorisdral added this pull request to the merge queue Mar 11, 2025
Merged via the queue into main with commit 034f718 Mar 11, 2025
27 checks passed
@jorisdral jorisdral deleted the jdral/swallowed-exceptions branch March 11, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants