Skip to content

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

Open
@neoneye

Description

@neoneye

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingminerLODA-RUST miner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions