Skip to content

Commit

Permalink
Fix full pruning crash
Browse files Browse the repository at this point in the history
  • Loading branch information
asdacap committed Dec 13, 2024
1 parent 7f32990 commit 3c6f70c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,14 @@ public TestContext(
FullPruningMaxDegreeOfParallelism = degreeOfParallelism,
FullPruningMemoryBudgetMb = fullScanMemoryBudgetMb,
FullPruningCompletionBehavior = completionBehavior
}, BlockTree, StateReader, ProcessExitSource, _chainEstimations, DriveInfo, Substitute.For<IPruningTrieStore>(), LimboLogs.Instance);
},
BlockTree,
StateReader,
ProcessExitSource,
_chainEstimations,
DriveInfo,
new TrieStore(NodeStorage, LimboLogs.Instance),
LimboLogs.Instance);
}

public async Task RunFullPruning()
Expand Down
8 changes: 4 additions & 4 deletions src/Nethermind/Nethermind.Trie/Pruning/TrieStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,13 +1004,13 @@ public void PersistCache(CancellationToken cancellationToken)
// need existing node will have to read back from db causing copy-on-read mechanism to copy the node.
void ClearCommitSetQueue()
{
while (_commitSetQueue.TryPeek(out BlockCommitSet commitSet) && commitSet.IsSealed)
while (CommitSetQueue.TryPeek(out BlockCommitSet commitSet) && commitSet.IsSealed)
{
if (!_commitSetQueue.TryDequeue(out commitSet)) break;
if (!CommitSetQueue.TryDequeue(out commitSet)) break;
if (!commitSet.IsSealed)
{
// Oops
_commitSetQueue.Enqueue(commitSet);
CommitSetQueue.Enqueue(commitSet);
break;
}

Expand All @@ -1019,7 +1019,7 @@ void ClearCommitSetQueue()
}
}

if (!(_commitSetQueue?.IsEmpty ?? true))
if (!CommitSetQueue.IsEmpty)
{
// We persist outside of lock first.
ClearCommitSetQueue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public void Dump()

public void ClearLivePruningTracking()
{
_persistedLastSeen.Clear();
_persistedLastSeen?.Clear();
_pastPathHash?.Clear();
}

Expand Down

0 comments on commit 3c6f70c

Please sign in to comment.