Skip to content

Commit 462c8bd

Browse files
fredericDelaportehazzik
authored andcommitted
Avoid completing twice the same transaction
As seen in #1729, some implementation may "complete" many time the same transaction. NHibernate enlistment should detect this and complete a single time.
1 parent 3b7fdfc commit 462c8bd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/NHibernate/Transaction/AdoNetWithSystemTransactionFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ protected virtual void ProcessSecondPhase(Enlistment enlistment, bool? success)
411411
/// otherwise.</param>
412412
protected virtual void CompleteTransaction(bool isCommitted)
413413
{
414+
// Some implementations (Mono) may "re-complete" the transaction on the cloned transaction disposal:
415+
// do an early exit here in such case.
416+
if (!IsInActiveTransaction)
417+
return;
414418
try
415419
{
416420
// Allow transaction completed actions to run while others stay blocked.

0 commit comments

Comments
 (0)