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

Sporadic crash in LRU - unwrap on None - pointer being freed was not allocated #24

Open
neoneye opened this issue Nov 28, 2022 · 0 comments
Labels
bug Something isn't working miner LODA-RUST miner

Comments

@neoneye
Copy link
Collaborator

neoneye commented Nov 28, 2022

The crash happens sometimes twice a day, sometimes the miner can run for 7 days without a crash.

Console output

thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', /Users/neoneye/.cargo/registry/src/github.com-1ecc6299db9ec823/lru-0.8.1/src/lib.rs:377:58
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
loda-rust(96264,0x16e0cb000) malloc: *** error for object 0x60003e5fbfe0: pointer being freed was not allocated
loda-rust(96264,0x16e0cb000) malloc: *** set a breakpoint in malloc_error_break to debug
zsh: abort      loda-rust mine --metrics

The crash happens in the lru package, in the function replace_or_create_node() in the line:

let mut old_node = self.map.remove(&old_key).unwrap();

The lru has a comment: "if the cache is full, remove the last entry so we can use it for the new key".

Hypothesis A, when the cache is full, and the LRU begin recycling the old elements, that may be where the crash happens.

Hypothesis B, too big a memory footprint, so alloc fails.

Hypothesis C, multi threading.

Solution A, experiment with other LRU packages.

Solution B, fix the code in LRU package.

@neoneye neoneye added miner LODA-RUST miner bug Something isn't working labels Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working miner LODA-RUST miner
Projects
None yet
Development

No branches or pull requests

1 participant