Skip to content
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

True async suppport #47

Closed
leo-vasiliev opened this issue Mar 8, 2023 · 3 comments
Closed

True async suppport #47

leo-vasiliev opened this issue Mar 8, 2023 · 3 comments

Comments

@leo-vasiliev
Copy link

AuditProcessManager and possibly other classes are lacking true async support. Database IO operations are blocking thread pool threads because AuditProcessManager's async methods just call the sync ones.

In this example, as entities are persisted and flushed by NHibernate with ISession.FlushAsync(), Envers calls ISession.Flush() on the audit entities:

...
00007F084F1005D0 00007F09A6EBCBA7 NHibernate.Impl.SessionImpl.Flush()
00007F084F100630 00007F09A6EAADF9 NHibernate.Envers.Synchronization.AuditProcessManager+transactionCompletionProcess.ExecuteBeforeTransactionCompletion()
00007F084F100650 00007F09A6EAACFD NHibernate.Envers.Synchronization.AuditProcessManager+transactionCompletionProcess.ExecuteBeforeTransactionCompletionAsync(System.Threading.CancellationToken)
00007F084F100660 00007F09A6EA9B52 NHibernate.Engine.ActionQueue+BeforeTransactionCompletionProcessQueue+<BeforeTransactionCompletionAsync>d__0.MoveNext()
00007F084F1006E0 00007F09A6EA9207 System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[NHibernate.Engine.ActionQueue+BeforeTransactionCompletionProcessQueue+<BeforeTransactionCompletionAsync>d__0, NHibernate]](<BeforeTransactionCompletionAsync>d__0 ByRef) [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs @ 38]
00007F084F100720 00007F09A6EA9172 NHibernate.Engine.ActionQueue+BeforeTransactionCompletionProcessQueue.BeforeTransactionCompletionAsync(System.Threading.CancellationToken)
00007F084F100770 00007F09A6DFE4EC NHibernate.Impl.SessionImpl+<BeforeTransactionCompletionAsync>d__79.MoveNext()
00007F084F100830 00007F099FEC10AB System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 183]
00007F084F100890 00007F09A6EA8F89 System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib],[NHibernate.Impl.SessionImpl+<BeforeTransactionCompletionAsync>d__79, NHibernate]].MoveNext(System.Threading.Thread) [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @ 324]
00007F084F1008E0 00007F099FF9F396 System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs @ 795]
00007F084F100920 00007F099FEE19B8 System.Threading.Tasks.Task.RunContinuations(System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 3374]
00007F084F1009D0 00007F09A6DFFC31 NHibernate.Impl.SessionImpl+<FlushAsync>d__65.MoveNext()
...
@RogerKratz
Copy link
Collaborator

Yes, true.
I won't have time to look into this in the near future, but feel free to contribute

@leo-vasiliev
Copy link
Author

Okay, let me see what the level of effort is, and I might give it a shot

@dennis-gr
Copy link
Contributor

Fixed with #50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants