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
Use EnterTransaction() before EnterLock(name) exceptions with v5.0.19 #2442
Comments
I also use a singleton instance and consume it in a transient service that gets invoked by a scheduler, very simple code I've used in other projects for years and seemingly at random the same issue popped up. I'll try letting my service run with an older version now like you suggested and see if it goes away, thank you! |
Hm, odd, after the downgrade and letting it run for an hour I now consistently run into a different error with v5.0.17:
Faulty code: internal class SearchResultCommandHandler : IRequestHandler<SearchResultCommand>
{
private readonly LiteDatabase _db;
private readonly ILogger<SearchResultCommandHandler> _logger;
private readonly IMediator _mediator;
public SearchResultCommandHandler(ILogger<SearchResultCommandHandler> logger, IMediator mediator, LiteDatabase db)
{
_logger = logger;
_mediator = mediator;
_db = db;
}
public Task Handle(SearchResultCommand request, CancellationToken cancellationToken)
{
try
{
ILiteCollection<StateEntity>? collection = _db.GetCollection<StateEntity>("Searches");
StateEntity entity = collection.FindOne(entry => entry.SearchTerm == request.SearchTerm) ??
new StateEntity { SearchTerm = request.SearchTerm };
...
}
}
} I don't really see any API misuse here 🤔 |
I an confirm this same |
the following code worked many months perfect on version 5.0.17, but after upgrade to 5.0.19 it started to fail.
LiteDB.LiteException: Use EnterTransaction() before EnterLock(name) |
Thanks folks, I was starting to think I was imagining things, something sure broke over the past 2 releases 😅 |
I have the same error, but the location of the error is slightly different.
|
Could this be recognized and triaged as a bug please, or some explanation provided what we might do wrong otherwise? Cheers. |
I can confirm this behavior, rolled back to 5.0.17 |
I can confirm this behavior too(, rolled back to 5.0.17 |
I am using LiteDb as a singleton without any explicit transactions. It is merely a cache for me, not much actual concurrency is there. All tasks use their respective collections, with no concurrency at all on the collection level.
I am getting such an exception:
Then all consequent calls fail with the same or with:
Switching from 5.0.19 back to 5.0.17 instantly solved the issue.
The text was updated successfully, but these errors were encountered: