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

mdbx: race conditions in MdbxKV.Close (#8409) #9244

Merged
merged 3 commits into from
Jan 17, 2024
Merged

mdbx: race conditions in MdbxKV.Close (#8409) #9244

merged 3 commits into from
Jan 17, 2024

Commits on Jan 17, 2024

  1. mdbx: race conditions in MdbxKV.Close (#8409)

    In the previous code WaitGroup db.wg.Add(), Wait() and db.closed were not treated in sync.
    In particular, it was theoretically possible to first check closed, then set closed and Wait, and then call wg.Add() while waiting
    (leading to WaitGroup panic).
    In theory it was also possible that db.env.BeginTxn() is called on a closed or nil db.env,
    because db.wg.Add() was called only after BeginTxn (db.wg.Wait() could already return).
    
    WaitGroup is replaced with a Cond variable.
    Now it is not possible to increase the active transactions count on a closed database.
    It is also not possible to call BeginTxn on a closed database.
    battlmonstr committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    9fd36bc View commit details
    Browse the repository at this point in the history
  2. unit tests

    battlmonstr committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    85c594f View commit details
    Browse the repository at this point in the history
  3. lint fix

    battlmonstr committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    46f6573 View commit details
    Browse the repository at this point in the history