Skip to content

Deadlocking when calling DashMap::shrink_to_fit() on version 6.0.0 #304

Description

@JesusGuzmanJr

The older version of dashmap crate was working fine without deadlock.

Cargo.toml

[package]
edition = "2021"
name = "deadlock"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dashmap = "5.5.3"

main.rs

fn main() {
    let map = dashmap::DashMap::new();
    map.insert("hello", "world");
    map.shrink_to_fit();
    println!("done shrinking");
}

Terminal output:

jesus@MacBook:~/Developer/deadlock|main⚡ ⇒  cargo run
   Compiling deadlock v0.1.0 (/Users/jesus/Developer/deadlock)
    Finished dev [unoptimized + debuginfo] target(s) in 0.19s
     Running `target/debug/deadlock`
done shrinking

When I update to the lates 6.0.0 version, the Dashmap::shrink_to_fit() method deadlocks.
Cargo.toml

[package]
edition = "2021"
name = "deadlock"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dashmap = "6.0.0"

main.rs left unchanged.

Terminal output:

jesus@MacBook:~/Developer/deadlock|main⚡ ⇒  cargo run
   Compiling deadlock v0.1.0 (/Users/jesus/Developer/deadlock)
    Finished dev [unoptimized + debuginfo] target(s) in 0.34s
     Running `target/debug/deadlock`

Is there a regression or am I misusing the method?

Thanks,
Jesus Guzman, Jr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions