-
-
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
Option::unwrap()
panics in base_cache::Clocks::to_std_instant
#472
Comments
Thank you for reporting the issue. It looks like a bug in I could not figure out why I added the following workaround: - origin_std + (time.checked_duration_since(origin).unwrap())
+
+ // `checked_duration_since` should always succeed here because the `origin`
+ // is set when this `Cache` is created, and the `time` is either the last
+ // modified or last accessed time of a cached entry. So `time` should always
+ // be greater than or equal to `origin`.
+ //
+ // However, this is not always true when `quanta::Instant` is used as the
+ // time source? https://github.com/moka-rs/moka/issues/472
+ //
+ // (Or do we set zero Instant to last modified/accessed time somewhere?)
+ //
+ // As a workaround, let's use zero duration when `checked_duration_since`
+ // fails.
+ origin_std + (time.checked_duration_since(origin).unwrap_or_default()) |
Reopen for the root cause analysis. Note that the workaround added by #477 should be still valid and prevent the panic to occur. Hi @matheus23, If possible, can you please tell us what kind of CPU did you use when you got the panic (Intel, AMD, Apple, etc)? Knowing the CPU kind can help us to reproduce the issue and figure out if this is an issue in the I am not sure yet, but I am thinking this issue might be related to metrics-rs/quanta#61 ? Thanks! |
CPU: AMD Ryzen 7 PRO 6850U with Radeon Graphics EDIT: Looking at the linked issue:
Yep, this is the case here. |
Can confirm the 0.12.9 release fixes this issue for me 👍 |
Thank you for the CPU information and also testing v0.12.9! I created a GH issue on |
In my app I'm using
hickory_resolver
, which uses a DNS resolver, which has a cache that's implemented usingmoka
.I don't think it's using the API incorrectly, but
moka
ends up panicking sometimes. The backtrace for that is:(and then some more stuff involving hickory's
LookupFuture
, and finally application code)I think this is more likely a bug in
moka
, but it might also be a bug inhickory
. If you're sure it's a bug in hickory, I can close this issue and file another issue in the hickory repository.The text was updated successfully, but these errors were encountered: