-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Unable to use moka when miri testing #407
Comments
Hi. Sorry for the late reply. I got COVID-19 for the first time in the middle of March. I was treated for pneumonia in the hospital but had a high fever for 10+ days. I am still recovering, and am slowly getting better.
Let me show you workarounds so that you can run Miri on your project that depends on
|
Hey, don't worry at all! I hope you're recovering well. Thank you for investigating this, it looks like we might be able to run these tests after all! What are the implications of disabling the |
There are two downsides of disabling the
As for 1,
https://github.com/moka-rs/moka/blob/v0.12.5/src/common/concurrent/entry_info.rs#L20-L22 The last modified time is used by The size of The size of Here is how I got the numbers: Modified diff --git a/src/sync/cache.rs b/src/sync/cache.rs
index fc5e5b4..c1cc5f7 100644
--- a/src/sync/cache.rs
+++ b/src/sync/cache.rs
@@ -686,6 +686,12 @@ impl<K, V, S> Cache<K, V, S> {
pub fn weighted_size(&self) -> u64 {
self.base.weighted_size()
}
+
+ /// Returns the size of the `AtomicInstant` in bytes.
+ pub fn size_of_atomic_instant() -> usize {
+ use crate::common::concurrent::atomic_time::AtomicInstant;
+ std::mem::size_of::<AtomicInstant>()
+ }
}
impl<K, V> Cache<K, V, RandomState> Added fn main() {
let byte_size = moka::sync::Cache::<(), ()>::size_of_atomic_instant();
println!("Size of AtomicInstant: {} bytes", byte_size);
} Ran it with and without the ## With the `quanta` feature.
$ cargo run -F sync --example show_size_of_atomic_instant
Size of AtomicInstant: 8 bytes
## Without the `quanta` feature.
$ cargo run --no-default-features -F sync --example show_size_of_atomic_instant
Size of AtomicInstant: 24 bytes As for 2, getting the current instant (monotonically increasing time) using However, the performance difference will be negligible in most cases. So this will be only noticeable in high-throughput scenarios. |
Hi, I've recently been setting up a project with moka, thanks for all of your work on it!
As part of this, I've been looking at setting up miri testing, but it seems that it's impossible to use miri tests with any moka code at the moment. Using the example code at https://docs.rs/moka/latest/moka/future/struct.Cache.html#example-insert-get-and-invalidate, running
cargo +nightly miri run --target x86_64-unknown-linux-gnu
results in the following.This seems to be coming from it's use of quanta, as something as simple as
quanta::Clock::new();
reproduces the underlying error.Additional info:
Please let me know if there's any other information I can provide! 🙂
The text was updated successfully, but these errors were encountered: