Comments (9)
I think there are some ways to do that ... let me look into the miri exclusion. But I'm also happy to put in a PR to improve this, so hopefully I have some time this week :)
Thanks for your patience with me on this!
from lru-rs.
Hey! Thanks for reporting this. Can you also provide the command that you're using to run miri
? When I run it locally myself I don't get any errors:
$ cargo miri run --target x86_64-unknown-linux-gnu
Compiling compiler_builtins v0.1.27
Checking core v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore)
Compiling cc v1.0.50
Compiling libc v0.2.69
Compiling autocfg v0.1.7
Compiling std v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd)
Compiling hashbrown v0.6.2
Compiling backtrace-sys v0.1.37
Compiling unwind v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/libunwind)
Checking rustc-std-workspace-core v1.99.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
Checking cfg-if v0.1.10
Checking alloc v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/liballoc)
Checking rustc-demangle v0.1.16
Checking panic_abort v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/libpanic_abort)
Checking backtrace v0.3.46
Checking rustc-std-workspace-alloc v1.99.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/tools/rustc-std-workspace-alloc)
Checking panic_unwind v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/libpanic_unwind)
Finished release [optimized] target(s) in 19.89s
Checking rustc-std-workspace-std v1.99.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/tools/rustc-std-workspace-std)
Checking proc_macro v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/libproc_macro)
Checking term v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/libterm)
Checking unicode-width v0.1.6
Checking getopts v0.2.21
Checking test v0.0.0 (/Users/jeromefroelich/.rustup/toolchains/nightly-2020-05-09-x86_64-apple-darwin/lib/rustlib/src/rust/src/libtest)
Finished release [optimized] target(s) in 2.58s
from lru-rs.
Hey there,
I think the issue is here https://github.com/jeromefroe/lru-rs/blob/master/src/lib.rs#L222
It looks like you are making a new MaybeUninit, and then immediately calling https://doc.rust-lang.org/std/mem/union.MaybeUninit.html#method.assume_init on it, which can't be valid because you don't have an LruEntry inside the MaybeUninit at that point I think. This is what appears to confuse the ManualDrop::into_inner because there is no pointer inside of the MaybeUninit at that point.
Anyway, I'm running this from my concread
library, and the commands would be:
git clone https://github.com/Firstyear/concread.git
cargo clean && cargo miri setup && cargo miri test -- -Zmiri-disable-isolation -- test_cache_concurrent_cursed_1
Which should give you the error.
Hope that helps, and thanks for your time :)
from lru-rs.
Ahh, so I believe that should be okay because we implement Drop
for the LruCache
where we handle the head
and tail
entries specially. We never initialize head
and tail
normally, but that's okay because we only ever use the next
and prev
fields of them.
from lru-rs.
I guess the challenge is while it's okay and we know it's okay, convincing miri to agree with that situation :)
Maybe it's not my place to say, but perhaps the way to resolve this is have MaybeUninit K, V in the LruEntry itself rather than in the Box so you can initialise the sigil nodes, or to remove the sigil nodes and set head/tail to ptr::null_mut() and change the double linked list algorithm to suit.
from lru-rs.
Yea, is there a way to exclude lines from Miri? That might be the simplest solution. PR's are also more than welcome if you have any other implementation ideas :)
from lru-rs.
This PR relates to this issue #74
Thanks!
from lru-rs.
Also as a note, it's not possible to provide a miri exclusion beyond the granularity of excluding a whole test, so we can't just mask this one area from examination.
from lru-rs.
Closing this now that #74 has landed.
from lru-rs.
Related Issues (20)
- RwLock read() usage HOT 1
- Consider replacing HashMap with HashSet HOT 1
- Use after free bug in lru crate HOT 2
- Am I able to cache egui? HOT 1
- Lifetime fix is missing from the changelog for 0.7.4 HOT 2
- Full check leak report reachable bytes HOT 1
- Method that removes an entry corresponding to the key and returns both the key and the value
- Failed to build with feature "nightly" HOT 1
- Allow more liberal closure for `get_or_insert` HOT 2
- Could we have a new version with the updated `hashbrown` (and maybe others) dependency ? HOT 2
- Support const new
- Limit by memory instead of number of items HOT 4
- Cache size 0 / Disable Cache HOT 3
- Cache key may not work HOT 5
- Debug not defined for custom BuildHasher
- Missing lifetime specifier in try_get_or_insert_mut? HOT 1
- Add `get_key_value` method
- Proposal to Integrate SIEVE Eviction Algorithm HOT 12
- Implement Clone on LruCache HOT 5
- Clone is only implemented for the default hasher HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lru-rs.