LiteDB icon indicating copy to clipboard operation
LiteDB copied to clipboard

[BUG] No thread safety since 5.0.21

Open feitzi opened this issue 1 year ago • 6 comments

Version 5.0.21

Describe the bug We assume that a LiteDatabase instance is not thread-safe since the last update (V 5.0.21), maybe this PR was wrong: #2447 Our application writes code to the same LiteDatabase instance in different threads. And since 5.0.21 we have a strange bug that sometimes writes corrupt data.

feitzi avatar Oct 11 '24 11:10 feitzi

Solved?

novecento avatar Jan 06 '25 22:01 novecento

this is the same issue as this.

https://github.com/litedb-org/LiteDB/issues/2528

dos-ise avatar Jan 07 '25 09:01 dos-ise

I have a litedb 4 in production that works very well since 2018. now I'm going to update application, and I'm thinking to update litedb to 5. reading this kind of issue don't put me on a good feeling :-) what do you think about?

novecento avatar Jan 07 '25 09:01 novecento

I have written a test project showing the bug & effect. We will update our older issue and that should help to fix it.

As written by others the bug was introduced in one of the last releases. For us it was visible as we updated from .20 to .21.

So, the good news is that older versions should be safe. We downgraded to .20 after we noticed the effect and other report .17 as safe.

michtoen avatar Jan 07 '25 09:01 michtoen

Here is an Examlpe Repo cleary showing the problem.

https://github.com/dos-ise/LiteDB_ThreadSafetyTest

dos-ise avatar Jan 08 '25 15:01 dos-ise

Thanks 👍

JKamsker avatar Jan 08 '25 15:01 JKamsker