A concurrency problem in SQLiteWallet
because of across execution
#3534
Labels
discussion
Initial issue state - proposed but not yet accepted
enhancement
Type - Changes that may affect performance, usability or add new features to existing modules.
Describe the bug
In
SQLiteWallet
, it uses two lock to avoid concurrency problems:lock (accounts)
to protect theaccounts
structure;lock (db_lock)
to protect theWalletDataContext
;Because there are two locks, and there not locked at the same time.
This method may lead to some problems in some cases, for example:
CreateAccount
and theDeleteAccount
:These two methods use same lock step:
It may lead to unconsistency state if a thread executed
AddAccount
step 1 and switched out, then another thread executedDeleteAccount
step 1 and step 2, then thread-1 executesAddAccount
step 2.CreateAccount
s: Similar execution process.The text was updated successfully, but these errors were encountered: