Function `load_client` ambiguous behaviour
vuongDang opened this issue · comments
Bug description
The function load_client
from a Stronghold
instance creates a new Client
instance every time even if there is already another Client
with the same path being used.
This can be an issue when using Stronghold with multiple threads. Multiple threads could get different clients with the same path which can result in unpredictable behavior when commiting these clients to the snapshot.
Rust version
Which version of Rust are you running?
- Rust version: 1.63
Steps To reproduce the bug
Explain how the maintainer can reproduce the bug.
- Create 2 threads
- Call
load_client
from the two threads - Modify these clients
- Commit the client of each thread
- Changes of one thread won't be kept in the Snapshot
Expected behaviour
Changes from both clients should be saved in the snapshot
Actual behaviour
Only the changes of one client is left in the snapshot