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

Temporary work around for crash #20666

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions crates/sui-core/src/execution_cache/cache_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::sync::Arc;
use std::{cmp::Ordering, hash::DefaultHasher};

use moka::sync::Cache as MokaCache;
use mysten_common::debug_fatal;
use parking_lot::Mutex;
use sui_types::base_types::SequenceNumber;

Expand Down Expand Up @@ -177,7 +178,7 @@ const KEY_GENERATION_SIZE: usize = 1024 * 16;

impl<K, V> MonotonicCache<K, V>
where
K: Hash + Eq + Send + Sync + Copy + 'static,
K: Hash + Eq + Send + Sync + Copy + std::fmt::Debug + 'static,
V: IsNewer + Clone + Send + Sync + 'static,
{
pub fn new(cache_size: u64) -> Self {
Expand Down Expand Up @@ -291,10 +292,13 @@ where
let mut entry = entry.value().lock();
check_ticket()?;

// Ticket expiry makes this assert impossible.
// TODO: relax to debug_assert?
assert!(!entry.is_newer_than(&value), "entry is newer than value");
*entry = value;
if entry.is_newer_than(&value) {
// TODO: Ticket expiry should this assert impossible. While trying to root cause
// the bug we can simply ignore the insert.
debug_fatal!("entry is newer than value for key {:?}", key);
} else {
*entry = value;
}
}

Ok(())
Expand Down
Loading