Starts in:
1 DAY
7 HRS
59 MIN
26 SEC
Starts in:
1 D
7 H
59 M
26 S
Open Closed

AbpDbConcurrencyException while updating in multi threading #1018


User avatar
0
lalitChougule created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v3.0.4
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no / yes
  • Exception message and stack trace: Mentioned below
  • Steps to reproduce the issue: Update multiple records using multi threading

While updating from multiple threads, the updateAsync() throws error sometime not always, error as below

Exception - Volo.Abp.Data.AbpDbConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.

I tried using await CurrentUnitOfWork.SaveChangesAsync(); but then my Db went into DeadLock state.


2 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    can you try to wrap the code with a new Unit Of Work block https://docs.abp.io/en/abp/latest/Unit-Of-Work#begin-a-new-unit-of-work

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06