question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] Object synchronization method was called from an unsynchronized block of code

See original GitHub issue

I’m getting this error intermittently while running with ConnectionType.Shared and don’t with the default.

System.ApplicationException: Object synchronization method was called from an unsynchronized block of code.

   at System.Threading.Mutex.ReleaseMutex()
   at LiteDB.SharedEngine.CloseDatabase()
   at LiteDB.SharedEngine.Upsert(String collection, IEnumerable`1 docs, BsonAutoId autoId)
System.ApplicationException: Object synchronization method was called from an unsynchronized block of code.
   at System.Threading.Mutex.ReleaseMutex()
   at LiteDB.SharedEngine.CloseDatabase()
   at LiteDB.SharedDataReader.Dispose()
   at LiteDB.LiteQueryable`1.ToDocuments()+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToList()

I tried researching this but haven’t come up with any ideas. Does anyone have any suggestions on why I’m getting this?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:9
  • Comments:39 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
dlidstromcommented, Aug 15, 2022

@a44281071 no this isn’t fixed in 5.0.12. Obviously multi-threading is complicated to get right. Unfortunately the readme file claims LiteDb is thread-safe, when it really isn’t fully (yet…).

2reactions
tabscommented, Dec 12, 2022

same problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object synchronization method was called from an ...
Object synchronization method was called from an unsynchronized block of code. Exception on Mutex.Release() · Ask Question. Asked 11 years, 6 ...
Read more >
Object synchronization method was called from an ...
Question, Why is happening this error: Object synchronization method was called from an unsynchronized block of code. ? Pin. FANMixco7-Jan-15 8:38.
Read more >
Synchronization by lock and Monitor statements in C# | Medium
The `lockerObject ` is a synchronizing object that can be locked by only one ... synchronization method was called from an unsynchronized block...
Read more >
C# – Object synchronization method was called from an ...
I receive an exception in production with message "Object synchronization method was called from an unsynchronized block of code" on Mutex.
Read more >
Object synchronization method was called from an ... - YouTube
C# : Object synchronization method was called from an unsynchronized block of code. Exception on Mutex.Release() To Access My Live Chat Page ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found