Skip to content

Commit 2ecb8d4

Browse files
Remove the crutch for a very unlikely concurrency possibility
1 parent d981d26 commit 2ecb8d4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/NHibernate/Transaction/AdoNetWithSystemTransactionFactory.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,12 @@ protected virtual void CompleteTransaction(bool isCommitted)
488488
// In case of a rollback due to a timeout, we may have the session disposal running concurrently
489489
// to the transaction completion in a way our current locking mechanism cannot fully protect: the
490490
// session disposal "BeginProcess" can go through the Wait before it is locked but flag the
491-
// session as procesisng after the transaction completion has read it as not processing. To dodge
492-
// that case, we consider the session as still processing initially regardless of its actual
493-
// status in case of rollback.
494-
var isSessionProcessing = !isCommitted || _session.IsProcessing();
491+
// session as processing after the transaction completion has read it as not processing. To dodge
492+
// that very unlikely case, we could consider the session as still processing initially regardless
493+
// of its actual status in case of rollback by changing below condition to
494+
// "!isCommitted || _session.IsProcessing()". That would cause a Thread.Sleep in all rollback cases.
495+
// That would reinforce the impracticality of that concurrency possibility, but with an ugly crutch.
496+
var isSessionProcessing = _session.IsProcessing();
495497
try
496498
{
497499
// Allow transaction completed actions to run while others stay blocked.

0 commit comments

Comments
 (0)