question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No active Transaction was found for ID

See original GitHub issue

Describe the bug

When performing transactional processing (using TransactionScope and send-via feature) of messages concurrently, using multiple message senders, the System.InvalidOperationException exception is thrown.

Exception or Stack Trace

System.InvalidOperationException: No active Transaction was found for ID 'txn:9e879b829a0e446d97d6ac7625862833:9_G5'. The Transaction may have timed out or attempted to span multiple top-level entities such as Queue or Topic. The server Transaction timeout is: 00:02:00. Reference:fbcf536a-d67a-4a0f-8fb7-7532b8360f78, TrackingId:44c4b18d00000014000024ca5c5832b5_G5_B7, SystemTracker:SOMSYSTEMNAME:Queue:SOMEQUEUENAME, Timestamp:2019-02-04T12:40:21
   at Microsoft.Azure.ServiceBus.Core.MessageSender.OnSendAsync(IList`1 messageList)
   at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
   at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
   at Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync(IList`1 messageList)
   at NServiceBus.TransportReceiveToPhysicalMessageProcessingConnector.Invoke(ITransportReceiveContext context, Func`2 next)
   at NServiceBus.MainPipelineExecutor.Invoke(MessageContext messageContext)
   at NServiceBus.Transport.AzureServiceBus.MessagePump.ProcessMessage(Task`1 receiveTask)

To Reproduce

Repro code is located in https://github.com/SeanFeldman/TransactionIssueRepro, TransactionIssueRepro.sln

  • Sender project is seeding the receiver’s queue with messages
  • Receiver project is logging message processing.
  • For each processed message, ten outgoing messages are emitted

Code Snippet

See the previous section

Expected behavior

There should be no exceptions.

Screenshots

N/A image

Setup (please complete the following information):

  • OS: Windows 10 Pro 1903
  • IDE : VS 2019 16.1.3
  • Azure Service Bus 3.4.0 / netcoreapp2.2

Additional context

When concurrency is set to one and a single outgoing MessageSender is used, this exception is not thrown. Whenever concurrency is higher than one, the exception is thrown.

Originally reported by NServiceBus customers using Azure Service Bus transport here. My investigation led to the native repro w/o NServiceBus code in it.

All NServiceBus customers on ASB transport with transactions enabled are affected 🐼

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:18 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
SeanFeldmancommented, Aug 14, 2019

@jfggdl I’ve re-run a test and it looks like the fix is in place 🎉 Thank you and the team on my and my customers’ behalf.

2reactions
nemakamcommented, Jun 18, 2019

@SeanFeldman , the bug is being worked on. The repro code is doing its job just fine! (y)

Read more comments on GitHub >

github_iconTop Results From Across the Web

PHP PDO - There is no active transaction
The reason you got error is because you were trying to close a transaction when it was already closed. beginTransaction opens one, and...
Read more >
How to resolve No active transaction for PuId=WC ...
In order to resolve this issue, before committing, check whether the transaction is active. if(TransactionManager.isTransactionActive()){ //logic to persist ...
Read more >
There is no currently active transaction error in ...
The login to Web Console fails with the error: Commit attempt failed (There is no currently active transaction) Note: the same error message ......
Read more >
Power Automate Flow Error: There Is No Active Transaction
This error is usually caused by custom plug-ins that ignore errors from service calls and continue processing. Code:0X80040251 InnerError: '- ...
Read more >
Smart-ID app displays "No transaction found"
If you opened the app while there were no active requests, you'll see “No transaction found” message. It's not a warning and nothing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found