Search code examples
c#ravendbravendb4

A write transaction is already opened by this thread in RavenDB4


I am attempting to update RavenDB storage for hangfire to RavenDB4 and I sometimes receive the following exception:

Raven.Client.Exceptions.RavenException: 'System.InvalidOperationException: A write transaction is already opened by this thread

I checked for unclosed session, but all session but one use using and the last one is specific because it is part of a class that acts like a transaction builder and is disposed on commit. I was unable to find what operations might take longer in the background or what could cause it.

I'd appreciate a little help with narrowing down what could cause this, because I have absolutely no idea and documentation didn't help much.


Solution

  • After upgrading to nightly version of RavenDB4 instead of RavenDB 4.0.0-rc-40025 (after Ayende Rahien suggested it should be a server issue) I never got this exception. I scheduling thousands of jobs before posting this as an answer to make sure it was server side issue.

    Before the upgrade I got the exception pretty much every time I scheduled many jobs.