LiteDB icon indicating copy to clipboard operation
LiteDB copied to clipboard

Check if the read lock is held before exiting

Open huyhu opened this issue 6 years ago • 2 comments

Check if the read lock is held before exiting.

huyhu avatar Apr 17 '20 15:04 huyhu

@huyhu Does this actually fix your use case? Do you have any tests for this PR? I'm worried this PR only masks an underlying issue (why did the transaction try to release a lock that it didn't hold in the first place?)

lbnascimento avatar Apr 20 '20 18:04 lbnascimento

I would agree it is important to find the underlying cause of the issue, however, adding this check does stop a fatal exception that takes down an application. I, too, have encountered this error several times in the past few months, and I have not been able to isolate it to anything in particular. (I am using the mutex locking scheme--ie. direct--with async tasks, request the least permission necessary for db activity, and wait retries where applicable).

Perhaps adding -- if (held) {remove} / else {log} -- type of solution would suffice without reviewing all the locking logic and retaining this bug.

dethknite avatar Jun 28 '22 06:06 dethknite