hhblaze / DBreeze

C# .NET NOSQL ( key value store embedded ) ACID multi-paradigm database management system.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating a new instance of the Engine not thread safe.

dangershony opened this issue · comments

A static dictionary is initiated without locks.

Not sure if this is intentional.

See comments in our code: https://github.com/stratisproject/StratisBitcoinFullNode/blob/master/Stratis.Bitcoin/Utilities/DBreezeSingleThreadSession.cs#L85

commented

Will take a look on Tuesday

commented

But I didn't get the the problem actually, DBreeze instance is definitely thread safe. First instance must be initiated and only after that it must be consumed - that should be obviously, that's why, intentionally, dictionaries in the constructor of the instance are lockless.

If you have 5 databases running in the same application and you need to create 5 engine instances where the creation is from 5 different threads you may get concurrncy errors due to shared static dictionary.

Thats fine if its intentional, but the instance creation is not thread safe.

We fixed it our side by protecting the initialization.

commented

v 1.089