Skip to content

Commit 4878759

Browse files
committed
fix: fully reset the cache before replenishing
1 parent 3062528 commit 4878759

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/transaction_processor.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,19 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
378378
config.limit_to_load_programs,
379379
);
380380

381+
// This means the cache is corrupted and runtime cannot load required programs
381382
if program_cache_for_tx_batch.hit_max_limit {
383+
// We retry once (will most likely succeed)
384+
// But to guarantee success we clear the cache
382385
if !replenish_retried {
383386
replenish_retried = true;
384-
self.program_cache
385-
.write()
386-
.unwrap()
387-
.prune(self.slot, self.epoch);
387+
let mut cache = self.program_cache.write().unwrap();
388+
// We need to reset the slot to avoid debug panics
389+
let slot = cache.latest_root_slot;
390+
cache.latest_root_slot = 0;
391+
cache.prune(0, 0);
392+
// And restore the slot to previous value after prune
393+
cache.latest_root_slot = slot;
388394
continue;
389395
}
390396

0 commit comments

Comments
 (0)