Skip to content

Conversation

@jasagredo
Copy link
Contributor

No description provided.

Copy link
Contributor

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

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

Hey Javier, good stuff here! Left some comment, let me know what you think

p <- atomically $ swapTVar tv' LedgerTablesHandleClosed
case p of
LedgerTablesHandleOpen{} -> encloseTimedWith (TraceLedgerTablesHandleClose >$< tracer) $ pure ()
_ -> pure ()
Copy link
Contributor

Choose a reason for hiding this comment

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

I can see it being useful to know how many times this happens. Shall we emit a trace here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it is that interesting. What would you infer with that information?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess I don't know when this will happen. The condition for this to happen might mean that smtn is off and a trace would help debug this?

@jasagredo jasagredo mentioned this pull request Dec 26, 2025
18 tasks
Base automatically changed from js/more-tracing-lsm to main December 26, 2025 13:02
@jasagredo
Copy link
Contributor Author

This seems to have introduced a bug in the immutable db re-opening:

        InMemV2:                                   FAIL (0.02s)
          *** Failed! (after 14 tests and 2 shrinks):
          Exception:
            Critical invariant violation: block Point (At (Block {blockPointSlot = SlotNo 2, blockPointHash = (testHashFromList [0,0])})) that was in immutable db is gone before we could open ledgerdb
            CallStack (from HasCallStack):
              error, called at src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/API.hs:651:7 in ouroboros-consensus-0.28.0.0-G57wL7N9zI82gdrWAL0a:Ouroboros.Consensus.Storage.LedgerDB.API
              replayStartingWith, called at src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/API.hs:608:17 in ouroboros-consensus-0.28.0.0-G57wL7N9zI82gdrWAL0a:Ouroboros.Consensus.Storage.LedgerDB.API
              initialize, called at src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB.hs:142:5 in ouroboros-consensus-0.28.0.0-G57wL7N9zI82gdrWAL0a:Ouroboros.Consensus.Storage.LedgerDB
              openDBInternal, called at test/storage-test/Test/Ouroboros/Storage/LedgerDB/StateMachine.hs:581:7 in ouroboros-consensus-0.28.0.0-8cYRJ7w2ktiTWKa1hs6id-storage-test:Test.Ouroboros.Storage.LedgerDB.StateMachine
          do action $ Init (SecurityParam (NonZero {unNonZero = 2})) 439
             action $ ValidateAndCommit 0 [TestBlockWith {tbHash = (testHashFromList [0]), tbSlot = SlotNo 1, tbValid = Valid, tbPayload = Tx {consumed = Token {unToken = Point Origin}, produced = (Token {unToken = Point (At (Block {blockPointSlot = SlotNo 1, blockPointHash = (testHashFromList [0])}))},TValue ())}},TestBlockWith {tbHash = (testHashFromList [0,0]), tbSlot = SlotNo 2, tbValid = Valid, tbPayload = Tx {consumed = Token {unToken = Point (At (Block {blockPointSlot = SlotNo 1, blockPointHash = (testHashFromList [0])}))}, produced = (Token {unToken = Point (At (Block {blockPointSlot = SlotNo 2, blockPointHash = (testHashFromList [0,0])}))},TValue ())}}]
             action $ ValidateAndCommit 0 [TestBlockWith {tbHash = (testHashFromList [0,0,0]), tbSlot = SlotNo 3, tbValid = Valid, tbPayload = Tx {consumed = Token {unToken = Point (At (Block {blockPointSlot = SlotNo 2, blockPointHash = (testHashFromList [0,0])}))}, produced = (Token {unToken = Point (At (Block {blockPointSlot = SlotNo 3, blockPointHash = (testHashFromList [0,0,0])}))},TValue ())}},TestBlockWith {tbHash = (testHashFromList [0,0,0,0]), tbSlot = SlotNo 4, tbValid = Valid, tbPayload = Tx {consumed = Token {unToken = Point (At (Block {blockPointSlot = SlotNo 3, blockPointHash = (testHashFromList [0,0,0])}))}, produced = (Token {unToken = Point (At (Block {blockPointSlot = SlotNo 4, blockPointHash = (testHashFromList [0,0,0,0])}))},TValue ())}}]
             action $ ForceTakeSnapshot
             action $ DropAndRestore 6 679
             pure ()
          Use --quickcheck-replay="(SMGen 16936070573903087192 8647692757720372959,13)" to reproduce.
          Use -p '/InMemV2/' to rerun this test only.

@jasagredo jasagredo force-pushed the js/leaks-v2 branch 2 times, most recently from ab26bd9 to f72045a Compare January 9, 2026 14:28
Copy link
Contributor

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +651 to +654
error $
"Critical invariant violation: block "
<> show from
<> " that was in immutable db is gone before we could open ledgerdb"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't need you to change this just a thought as I think we could do a nice spring cleaning when it comes to tracing.

I'd still like to have a machine readable log event for this outputted as CRITICAL, and ofc a human readable version of this.

LogFormatting class does that and it's in trace-dispatcher package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

4 participants