Closed JornWildt closed 7 years ago
It turns out that it happens as a result of a call to Bus.Defer(...) without await in front of it. We are now going through the code to add all the missing await keywords and then see if that fixes the problem.
Thanks for getting back to this one – I had completely forgotten about it 😨
Tests so far shows that the missing "defer" was indeed the problem. It makes sense too - if the caller of Defer() does not wait for it to complete and commits the transaction as soon as possible then that may happen before what ever SQL-interaction in Defer() is finished and thus give the above mentioned error.
Testing shows the issue is fixed.
Good news 👍
In a scenario where a service has been shutdown for a while, we get the following error when it starts going through the ton of messages that are waiting for it on start-up:
It does not happen for all of the messages - only very few.
A quick search for "The transaction operation cannot be performed because there are pending requests working on this transaction" reveals that it could be a "reader" somewhere that has not been closed (se for instance http://stackoverflow.com/questions/36552285/the-transaction-operation-cannot-be-performed-because-there-are-pending-requests).