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

Better logging of transaction expired exception #556

Closed
shlomii opened this issue Jul 29, 2012 · 2 comments
Closed

Better logging of transaction expired exception #556

shlomii opened this issue Jul 29, 2012 · 2 comments

Comments

@shlomii
Copy link
Contributor

shlomii commented Jul 29, 2012

Mailing thread at yahoo groups:
http://tech.groups.yahoo.com/group/nservicebus/message/15077

My Findings:

Using FullDuplex sample, and shortening the timeout by:

namespace MyServer
{
    [EndpointSLA("00:00:30")]
    public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization {
        public void Init()
        {
            Configure.With()
                .DefaultBuilder()
                .TransactionTimeout(TimeSpan.FromSeconds(10));
        }
    }
}

And having a thread sleep for more than 10 seconds in the Receiver (server) handler, the message goes (after SLR) to the error queue.

So it seems the behavior is correct, just the wrong error if any is logged.
An exception is being thrown at the server side when it tries to reply to the sender.
The exception that is being generated from MSMQ is of type: TransactionEnlist: "Cannot enlist the transaction"
But then NServiceBus catch it, and erroneously (a bug), throw QueueNotFoundException exception instead with the innter exception set to the the thrown TransactionEnlist exception:

https://github.com/NServiceBus/NServiceBus/blob/master/src/impl/unicast/queuing/NServiceBus.Unicast.Queuing.Msmq/MsmqMessageSender.cs#L39

If there is no Reply from the server (and no auditing), then the exception is caught at another place and also not logged:
https://github.com/NServiceBus/NServiceBus/blob/develop/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/TransactionalTransport.cs#L240

The following is the exception at this scenario:
System.Transactions.TransactionAbortedException occurred
Message=The transaction has aborted.
Source=System.Transactions
StackTrace:
at System.Transactions.TransactionStatePromotedAborted.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState)
at System.Transactions.CommittableTransaction.Commit()
at System.Transactions.TransactionScope.InternalDispose()
at System.Transactions.TransactionScope.Dispose()
at NServiceBus.Utils.TransactionWrapper.RunInTransaction(Action callback, IsolationLevel isolationLevel, TimeSpan transactionTimeout) in c:\Users\WorkUser\NServiceBus\src\utils\TransactionWrapper.cs:line 35
at NServiceBus.Unicast.Transport.Transactional.TransactionalTransport.Process() in c:\Users\WorkUser\NServiceBus\src\impl\unicast\transport\NServiceBus.Unicast.Transport.Transactional\TransactionalTransport.cs:line 229
InnerException: System.TimeoutException
Message=Transaction Timeout
InnerException:

@SimonCropp
Copy link
Contributor

@johnsimons isnt this the same scenario you verified yesterday? ie the error message is now sufficient?

@johnsimons
Copy link
Member

Yes same scenario. And error is now correct.
Can be closed

On Saturday, July 13, 2013, Simon Cropp wrote:

@johnsimons https://github.com/johnsimons isnt this the same scenario
you verified yesterday? ie the error message is now sufficient?


Reply to this email directly or view it on GitHubhttps://github.com//issues/556#issuecomment-20914697
.

Regards
John Simons
NServiceBus

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