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: resolve database deadlock: #4989

Merged
merged 4 commits into from
Apr 18, 2024
Merged

fix: resolve database deadlock: #4989

merged 4 commits into from
Apr 18, 2024

Commits on Apr 12, 2024

  1. fix: resolve database deadlock:

    The `rotateWithLock` function holds a lock while it calls a callback
    function that's passed in by the caller. This is a problematic design
    that needs to be used very carefully. In this case, at least one caller
    passed in a callback that eventually relocks the mutex on the same
    thread, causing UB (a deadlock was observed). The caller was from
    SHAMapStoreImpl, and it called `clearCaches`. This `clearCaches` can
    potentially call `fetchNodeObject`, which tried to relock the mutex.
    
    This patch resolves the issue by changing the mutex type to a
    `recursive_mutex`. Ideally, the code should be rewritten so it doesn't
    hold the mutex during the callback and the mutex should be changed back
    to a regular mutex.
    seelabs committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    76ee8d6 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2024

  1. Configuration menu
    Copy the full SHA
    d7ff96d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f908fa View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e6e26d4 View commit details
    Browse the repository at this point in the history