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

Creating a new instance of the Engine not thread safe. #43

Closed
dangershony opened this issue Aug 22, 2017 · 4 comments
Closed

Creating a new instance of the Engine not thread safe. #43

dangershony opened this issue Aug 22, 2017 · 4 comments

Comments

@dangershony
Copy link

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

@hhblaze
Copy link
Owner

hhblaze commented Aug 25, 2017

Will take a look on Tuesday

@hhblaze
Copy link
Owner

hhblaze commented Aug 25, 2017

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.

@dangershony
Copy link
Author

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.

@hhblaze
Copy link
Owner

hhblaze commented Aug 29, 2017

v 1.089

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants