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

[BUG] NoThunks assertions failures when using modifyMVarMasked #444

Open
jorisdral opened this issue Oct 29, 2024 · 0 comments
Open

[BUG] NoThunks assertions failures when using modifyMVarMasked #444

jorisdral opened this issue Oct 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jorisdral
Copy link
Collaborator

Describe the bug
The use of strict-mvar's modifyMVarMasked_ and modifyMVarMasked functions in the Database.LSMTree.Internal.MergeSchedule module make our NoThunks tests fail. We start to use these functions in #426, and subsequently NoThunks assertions started failing. As part of #426, the assertions are temporarily disabled.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Test.Database.LSMTree.Normal.StateMachine.runIO
  2. Replace the line const id (assertNoThunks sesh) $ pure () by assertNoThunks sesh $ pure ()
  3. Run cabal run lsm-tree-test -- -p '$NF=="propLockstep_RealImpl_MockFS_IO"'

Expected behavior
These strict-mvar functions are expected to be strict enough to not leave any (shallow) thunks in our code. We should investigate why the NoThunks assertions fail, and then enable them again.

Output

❯ cabal run lsm-tree-test -- -p '$NF=="propLockstep_RealImpl_MockFS_IO"'
lsm-tree
  Normal.StateMachine
    propLockstep_RealImpl_MockFS_IO: FAIL (4.87s)
      *** Failed! (after 27 tests and 79 shrinks):
      Exception:
        Assertion failed: found thunkThunkInfo {thunkContext = ["MergingRunState","StrictMVar IO","MergingRun","incomingRuns","Level","Boxed.Vector","tableLevels","TableContent","RWState","StrictTVar IO","RWVar","tableContent","TableHandleEnv IO HandleMock","TableHandleState","RWState","StrictTVar IO","RWVar","tableHandleState","TableHandle","Map","StrictMVar IO","sessionOpenTables","SessionEnv","SessionState","RWState","StrictTVar IO","RWVar","sessionState","Session'"], thunkInfo = Nothing}
        CallStack (from HasCallStack):
          error, called at src-extras/Database/LSMTree/Extras/NoThunks.hs:75:33 in lsm-tree-0.1.0.0-inplace-extras:Database.LSMTree.Extras.NoThunks
      do var26 <- action $ New (PrettyProxy @((Key1,Value1,Blob1))) (TableConfig {confMergePolicy = MergePolicyLazyLevelling, confSizeRatio = Four, confWriteBufferAlloc = AllocNumEntries (NumEntries 5), confBloomFilterAlloc = AllocFixed 10, confFencePointerIndex = CompactIndex, confDiskCachePolicy = DiskCacheNone, confMergeSchedule = Incremental})
         action $ Updates [(Key1 {_unKey1 = Small {getSmall = 0}},Delete),(Key1 {_unKey1 = Small {getSmall = 1}},Delete),(Key1 {_unKey1 = Small {getSmall = 3}},Delete),(Key1 {_unKey1 = Small {getSmall = 4}},Delete),(Key1 {_unKey1 = Small {getSmall = 2}},Delete),(Key1 {_unKey1 = Small {getSmall = 0}},Delete),(Key1 {_unKey1 = Small {getSmall = 2}},Delete),(Key1 {_unKey1 = Small {getSmall = 3}},Delete),(Key1 {_unKey1 = Small {getSmall = 4}},Delete),(Key1 {_unKey1 = Small {getSmall = 1}},Delete),(Key1 {_unKey1 = Small {getSmall = 0}},Delete),(Key1 {_unKey1 = Small {getSmall = 2}},Delete),(Key1 {_unKey1 = Small {getSmall = 3}},Delete),(Key1 {_unKey1 = Small {getSmall = 4}},Delete),(Key1 {_unKey1 = Small {getSmall = 1}},Delete),(Key1 {_unKey1 = Small {getSmall = 0}},Delete),(Key1 {_unKey1 = Small {getSmall = 2}},Delete),(Key1 {_unKey1 = Small {getSmall = 3}},Delete),(Key1 {_unKey1 = Small {getSmall = 4}},Delete)] (unsafeMkGVar var26 (FromRight . id))
         action $ Updates [(Key1 {_unKey1 = Small {getSmall = 1}},Delete),(Key1 {_unKey1 = Small {getSmall = 0}},Delete),(Key1 {_unKey1 = Small {getSmall = 1}},Delete),(Key1 {_unKey1 = Small {getSmall = 2}},Delete),(Key1 {_unKey1 = Small {getSmall = 3}},Delete),(Key1 {_unKey1 = Small {getSmall = 4}},Delete),(Key1 {_unKey1 = Small {getSmall = 0}},Delete),(Key1 {_unKey1 = Small {getSmall = 1}},Delete),(Key1 {_unKey1 = Small {getSmall = 2}},Delete),(Key1 {_unKey1 = Small {getSmall = 3}},Delete)] (unsafeMkGVar var26 (FromRight . id))
         pure ()
      Use --quickcheck-replay="(SMGen 14857188722218918723 2942465459729247775,26)" to reproduce.

1 out of 1 tests failed (4.87s)

Desktop (please complete the following information):

  • OS: Ubuntu
  • OS version: 22.04
  • GHC: ghc-9.6.6
@jorisdral jorisdral added the bug Something isn't working label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant