OpenBullet2 icon indicating copy to clipboard operation
OpenBullet2 copied to clipboard

[Bug]: Database Error - Cant write multiple hits to the DB

Open DryTi opened this issue 4 years ago • 1 comments

Version of the software

0.1.27

Operating system

Windows 10

Browser / Native

Native

What happened?

A bug happened! I get an error while more than one Thread is writing a Hit to the DB.

crash.log: Unhandled exception thrown on 12.12.2021 01:22:38 System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (A second operation was started on this context before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext. For more information on how to avoid threading issues with DbContext, see https://go.microsoft.com/fwlink/?linkid=2097913.) ---> System.InvalidOperationException: A second operation was started on this context before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext. For more information on how to avoid threading issues with DbContext, see https://go.microsoft.com/fwlink/?linkid=2097913. at Microsoft.EntityFrameworkCore.Internal.ConcurrencyDetector.EnterCriticalSection() at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList1 entriesToSave, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(DbContext _, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at OpenBullet2.Core.Repositories.DbRepository1.Add(T entity) at OpenBullet2.Core.Services.HitStorageService.Store(Hit hit) at RuriLib.Models.Jobs.MultiRunJob.RegisterHit(CheckResult result) --- End of inner exception stack trace ---

Relevant LoliCode if needed

No response

DryTi avatar Dec 12 '21 00:12 DryTi

Fixed on current staging branch, build soon

openbullet avatar May 07 '26 20:05 openbullet