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

fix: Deadlocks freezing the whole server after two DHT calls #51

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

SeverinAlexB
Copy link
Collaborator

Dashmap xacrimon/dashmap#316 occasionally causes a deadlock on Ubuntu 24. This froze the whole server. Mac would work just fine.

This PR replaces DashMap with a regular Mutex. Slower but works.

@SeverinAlexB SeverinAlexB merged commit 11637f5 into pubky:master Dec 17, 2024
@SeverinAlexB SeverinAlexB mentioned this pull request Dec 20, 2024
@SeverinAlexB SeverinAlexB deleted the fix-deadlocks branch December 27, 2024 13:49
@xacrimon
Copy link

xacrimon commented Feb 1, 2025

This isn't a dashmap bug. You're calling entry and storing a RefMut, an exclusive reference equivalent to a write lock in a local variable then calling .await while holding it. This will cause tokio to run another task, say it's running the same function on the same exact thread, causing a standard deadlock, as will any normal lock do.

This is documented in the API, and those guidelines were violated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants