From 7803ac4cbc8acc4df23e104017ecc149bce2a033 Mon Sep 17 00:00:00 2001 From: andreasohlund Date: Fri, 26 Apr 2013 18:48:09 +0200 Subject: [PATCH 1/3] Fixing an issue where the workers would not send a ready message if the processed message was returned from the error q. Bug was introduced in #571. Fixes #1133 Conflicts: src/NServiceBus.Core/Distributor/ReadyMessages/ReadyMessageSender.cs src/NServiceBus.Core/Unicast/Transport/TransportReceiver.cs Making sure that remote workers redirects their SLR to go through the distributor #1133 Conflicts: src/NServiceBus.Core/Unicast/Transport/TransportReceiver.cs Changing the logic for the #1133 fix not need to distributor config, this is due to the dependency structure of v3 --- .../ReadyMessages/ReadyMessageSender.cs | 9 ++------- ...eBus.Unicast.Transport.Transactional.csproj | 3 +++ .../TransactionalTransport.cs | 18 +++++++++++++++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/distributor/NServiceBus.Distributor/ReadyMessages/ReadyMessageSender.cs b/src/distributor/NServiceBus.Distributor/ReadyMessages/ReadyMessageSender.cs index 70bf89195b8..bc3448dab4d 100644 --- a/src/distributor/NServiceBus.Distributor/ReadyMessages/ReadyMessageSender.cs +++ b/src/distributor/NServiceBus.Distributor/ReadyMessages/ReadyMessageSender.cs @@ -25,16 +25,11 @@ public void Run() EndpointTransport.FinishedMessageProcessing += (a, b) => { - if (Bus.CurrentMessageContext.Headers.ContainsKey(NServiceBus.Headers.Retries)) - { - return; - } - - SendReadyMessage(1); + SendReadyMessage(); }; } - void SendReadyMessage(int capacityAvailable, bool isStarting = false) + void SendReadyMessage(int capacityAvailable = 1, bool isStarting = false) { //we use the actual address to make sure that the worker inside the masternode will check in correctly var readyMessage = ControlMessage.Create(Bus.InputAddress); diff --git a/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/NServiceBus.Unicast.Transport.Transactional.csproj b/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/NServiceBus.Unicast.Transport.Transactional.csproj index 3c0572594de..3ca389c6e56 100644 --- a/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/NServiceBus.Unicast.Transport.Transactional.csproj +++ b/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/NServiceBus.Unicast.Transport.Transactional.csproj @@ -53,6 +53,9 @@ ..\..\..\..\..\build\nservicebus.core\NServiceBus.Setup.Windows.dll + + ..\..\..\..\..\build\nservicebus.core\NServiceBus.Unicast.Config.dll + ..\..\..\..\..\build\nservicebus.core\NServiceBus.Unicast.Queuing.dll False diff --git a/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/TransactionalTransport.cs b/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/TransactionalTransport.cs index 04b187d708a..fe1374c12c7 100644 --- a/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/TransactionalTransport.cs +++ b/src/impl/unicast/transport/NServiceBus.Unicast.Transport.Transactional/TransactionalTransport.cs @@ -178,7 +178,23 @@ void ITransport.Start(string inputqueue) void ITransport.Start(Address address) { MessageReceiver.Init(address, IsTransactional); - FailureManager.Init(address); + + var returnAddressForFailures = address; + + //figure out if this transport is the one feeding messages into the unicastbus + if (returnAddressForFailures.Queue.ToLower().EndsWith(".worker") || address == Address.Local) //this is a hack until we can refactor the SLR to be a feature. "Worker" is there to catch the local worker in the distributor + { + //GetMasterNodeAddress returns Address.Local if no masternode is defined so we can safely call this for all endpoints + returnAddressForFailures = Configure.Instance.GetMasterNodeAddress(); + + if (address != returnAddressForFailures) + { + Logger.InfoFormat("Worker started, failures will be redirected to {0}", returnAddressForFailures); + } + } + + FailureManager.Init(returnAddressForFailures); + Logger.DebugFormat("Going to start [{0}] receiving thread/s for Address [{1}].", numberOfWorkerThreads, address); for (int i = 0; i < numberOfWorkerThreads; i++) AddWorkerThread().Start(); From aebb96f3cb86ee637dfafcd8d866a22698ad0d65 Mon Sep 17 00:00:00 2001 From: John Simons Date: Wed, 1 May 2013 13:25:15 +1000 Subject: [PATCH 2/3] Defaulted WCF to a nicer namespace, closes #616 Conflicts: src/NServiceBus.Core/IWcfService.cs --- src/integration/NServiceBus.Integration.WCF/IWcfService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/integration/NServiceBus.Integration.WCF/IWcfService.cs b/src/integration/NServiceBus.Integration.WCF/IWcfService.cs index 2680475e0f5..5a719638bbf 100644 --- a/src/integration/NServiceBus.Integration.WCF/IWcfService.cs +++ b/src/integration/NServiceBus.Integration.WCF/IWcfService.cs @@ -8,7 +8,7 @@ namespace NServiceBus /// /// /// - [ServiceContract] + [ServiceContract(Namespace = "http://nservicebus.com")] public interface IWcfService { /// From 392fee8673f2d9f35b7bc4b0ce9671af6cde2cd9 Mon Sep 17 00:00:00 2001 From: Johannes Gustafsson Date: Thu, 2 May 2013 11:31:27 +0200 Subject: [PATCH 3/3] Do not explicitly rollback an NH transaction to avoid race condition in NH. fixes #1153 --- .../NServiceBus.UnitOfWork.NHibernate/UnitOfWorkManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nhibernate/UnitOfWork/NServiceBus.UnitOfWork.NHibernate/UnitOfWorkManager.cs b/src/nhibernate/UnitOfWork/NServiceBus.UnitOfWork.NHibernate/UnitOfWorkManager.cs index 2effb818d59..443a4acdd88 100644 --- a/src/nhibernate/UnitOfWork/NServiceBus.UnitOfWork.NHibernate/UnitOfWorkManager.cs +++ b/src/nhibernate/UnitOfWork/NServiceBus.UnitOfWork.NHibernate/UnitOfWorkManager.cs @@ -35,7 +35,11 @@ void IManageUnitsOfWork.End(Exception ex) return; if (ex != null) - session.Transaction.Rollback(); + { + // Due to a race condition in NH3.3, explicit rollback can cause exceptions and corrupt the connection pool. + // Especially if there are more than one NH session taking part in the DTC transaction + //session.Transaction.Rollback(); + } else session.Transaction.Commit(); }