-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
UnitOfWork and Async calls - Abp Version 7.0.0 #6927
Comments
@pawelignaczak could you share your ABP version and format the code in the issue properly ? |
Done |
Thanks. Is it possible for you to prepare a sample project with this problem ? |
That would be difficult as the current project is big. Basically We get an event from remote server that triggers an async request with a new UoW: _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew).
or |
In fact i randomly get below error when try to call : System.InvalidOperationException: „A second operation was started on this context instance 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.” |
Could you share your startup.cs ? Especially services.AddAbp block. |
using System; namespace AseeVT.Web.Startup
} |
Thanks. This seems fine. Is it possible that your code has any async over sync usages ? If you are using Jetbrains Rider, you can find such usages in your code. If not, you can try to remove |
Well that's the point. We receive TCP events from other system and create an asyn event from it that process some actions on services. At the same time the services can be accessed from say frontend or SignalR. |
I mean only the code in your app, not how it is called outside from your app. |
Abp Version 7.0.0
What are the best practices for UnityOfWork lifecycle in frames of async request between services? We have some issues with UoW context getting lost in that scenario. If I have an event served as async like :
Seems like any await async call is causing drop of UoW context even if method is decorated with [UnitOfWork]
The text was updated successfully, but these errors were encountered: