当使用jmeter击中并发请求时,发生死锁异常?

时间:2018-08-09 11:45:47

标签: c# concurrency entity-framework-6 dbcontext

以下是将Ambient ContextEF6一起使用的C#代码

 public async Task<bool> RemoveRefreshToken(RefreshToken refreshToken)
    {
        using (var dbContextScope = _dbContextScopeFactory.Create())
        {
            _refreshTokenRepository.Delete(refreshToken);
            return await dbContextScope.SaveChangesAsync() > 0;
        }
    }

获取以下异常

Exception Source: EntityFramework   Inner Exception:  Transaction (Process ID 
89) was deadlocked on lock resources with another process and has been chosen 
as the deadlock victim. Rerun the transaction.

仅当使用JMeter进行并发请求时,才会发生此错误

0 个答案:

没有答案