RavenDB and ResourceManagerId
In a side by side deployment (this also affect the Distributor if we have more than 1 worker on the same machine), RavenDB distributed transaction get assigned the same ResourceManagerId. And this causes the following error:
2012-08-08 13:33:50,470 [Worker.14] WARN NServiceBus.Unicast.Transport.Transactional.TransactionalTransport [(null)] <(null)> - Failed raising 'transport message received' event for message with ID=6601cd40-306c-41fc-a0d5-fc5aa25d3218\15347598
System.Runtime.InteropServices.COMException (0x8004D102): A resource manager with the same identifier is already registered with the specified transaction coordinator. (Exception from HRESULT: 0x8004D102)
at System.Transactions.Oletx.IDtcProxyShimFactory.CreateResourceManager(GuidresourceManagerIdentifier, IntPtr managedIdentifier, IResourceManagerShim& resourceManagerShim)
at System.Transactions.Oletx.OletxResourceManager.get_ResourceManagerShim()
at System.Transactions.Oletx.OletxResourceManager.EnlistDurable(OletxTransaction oletxTransaction, Boolean canDoSinglePhase, IEnlistmentNotificationInternalenlistmentNotification, EnlistmentOptions enlistmentOptions)
at System.Transactions.Oletx.OletxTransaction.EnlistDurable(Guid resourceManagerIdentifier, ISinglePhaseNotificationInternal singlePhaseNotification, Boolean canDoSinglePhase, EnlistmentOptions enlistmentOptions)
at System.Transactions.TransactionStatePromotedBase.EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
at System.Transactions.Transaction.EnlistDurable(Guid resourceManagerIdentifier, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions)
at Raven.Client.Document.InMemoryDocumentSessionOperations.TryEnlistInAmbientTransaction() in c:\Builds\raven\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:line 874
at Raven.Client.Document.InMemoryDocumentSessionOperations.PrepareForSaveChanges() in c:\Builds\raven\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:line 773
at Raven.Client.Document.DocumentSession.SaveChanges() in c:\Builds\raven\Raven.Client.Lightweight\Document\DocumentSession.cs:line 406
at NServiceBus.Timeout.Hosting.Windows.Persistence.RavenTimeoutPersistence.Remove(String timeoutId) in c:\Projects\NServiceBus\src\timeout\NServiceBus.Timeout.Hosting.Windows\Persistence\RavenTimeoutPersistence.cs:line 110
at NServiceBus.Timeout.Core.Dispatch.TimeoutDispatchHandler.Handle(TransportMessage message) in c:\Projects\NServiceBus\src\timeout\NServiceBus.Timeout.Core\Dispatch\TimeoutDispatchHandler.cs:line 23
at NServiceBus.Timeout.Hosting.Windows.TimeoutMessageProcessor.OnTransportMessageReceived(Object sender, TransportMessageReceivedEventArgs e) in c:\Projects\NServiceBus\src\timeout\NServiceBus.Timeout.Hosting.Windows\TimeoutMessageProcessor.cs:line 49
at NServiceBus.Unicast.Transport.Transactional.TransactionalTransport.OnTransportMessageReceived(TransportMessage msg) in c:\Projects\NServiceBus\src\impl\unicast\transport\NServiceBus.Unicast.Transport.Transactional\TransactionalTransport.cs:line 480
The problem is that we use the endpoint address to generate a deterministic guid to use as ResourceManagerId
However as explained in this thread we shouldn't need to assign a deterministic Guid and instead we could use Guid.NewGuid.
We going with address.local + "semver" to generate a deterministic guid.
We're getting the semver in a few places, host, license etc. Lets centralize that as well
Will that really solve it? If there are 2 endpoints installed /sidebyside and the NSB dll:s are of the same version, then they will still get the same guid, won't they?
2012/8/8 John Simons [email protected]
We going with address.local + "semver" to generate a deterministic guid.
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577168.
The whole point with side by side is to use different versions. If not the win service name wouldn't be unique and the install would fail
On Wed, Aug 8, 2012 at 10:16 AM, Johannes Gustafsson < [email protected]> wrote:
Will that really solve it? If there are 2 endpoints installed /sidebyside and the NSB dll:s are of the same version, then they will still get the same guid, won't they?
2012/8/8 John Simons [email protected]
We going with address.local + "semver" to generate a deterministic guid.
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577168>.
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577730.
http://andreasohlund.net http://twitter.com/andreasohlund
Ok, but what is "semver" in this case? Is it the version of NSB or the version of my endpoint dll? Will you use fileversion or assembly version? Is the whole version number used, including revision?
2012/8/8 Andreas Öhlund [email protected]
The whole point with side by side is to use different versions. If not the win service name wouldn't be unique and the install would fail
On Wed, Aug 8, 2012 at 10:16 AM, Johannes Gustafsson < [email protected]> wrote:
Will that really solve it? If there are 2 endpoints installed /sidebyside and the NSB dll:s are of the same version, then they will still get the same guid, won't they?
2012/8/8 John Simons [email protected]
We going with address.local + "semver" to generate a deterministic guid.
— Reply to this email directly or view it on GitHub<
https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577168>.
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577730>.
http://andreasohlund.net http://twitter.com/andreasohlund
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577759.
https://github.com/NServiceBus/NServiceBus/blob/master/src/hosting/NServiceBus.Hosting.Windows/Program.cs#L144
I see. Although I would prefer to also include the revisionid in the resourcemanager id. I often deploy new endpoints by only incrementing revision (which is svn-revision in my case).
2012/8/8 John Simons [email protected]
https://github.com/NServiceBus/NServiceBus/blob/master/src/hosting/NServiceBus.Hosting.Windows/Program.cs#L144
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7578245.
Its the first 3 numbers in the fileversion of your endpoint assembly
https://github.com/NServiceBus/NServiceBus/blob/master/src/hosting/NServiceBus.Hosting.Windows/Program.cs#L144
On Wed, Aug 8, 2012 at 10:40 AM, Johannes Gustafsson < [email protected]> wrote:
Ok, but what is "semver" in this case? Is it the version of NSB or the version of my endpoint dll? Will you use fileversion or assembly version? Is the whole version number used, including revision?
2012/8/8 Andreas Öhlund [email protected]
The whole point with side by side is to use different versions. If not the win service name wouldn't be unique and the install would fail
On Wed, Aug 8, 2012 at 10:16 AM, Johannes Gustafsson < [email protected]> wrote:
Will that really solve it? If there are 2 endpoints installed /sidebyside and the NSB dll:s are of the same version, then they will still get the same guid, won't they?
2012/8/8 John Simons [email protected]
We going with address.local + "semver" to generate a deterministic guid.
— Reply to this email directly or view it on GitHub<
https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577168>.
— Reply to this email directly or view it on GitHub<
https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577730>.
http://andreasohlund.net http://twitter.com/andreasohlund
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7577759>.
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-7578169.
http://andreasohlund.net http://twitter.com/andreasohlund
We just detected it today again with the newest version of ravendb and multiple NSB hosts running on the same machine. We have the following setup:
RavenDB 2261 RavenPersistence for Saga On RavenDB DocumentStore for our domain data
@johnsimons Do you remember if ayende re-introduced the rm-id in Raven 2?
On Fri, Feb 15, 2013 at 6:56 PM, danielmarbach [email protected]:
We just detected it today again with the newest version of ravendb and multiple NSB hosts running on the same machine. We have the following setup:
RavenDB 2261 RavenPersistence for Saga On RavenDB DocumentStore for our domain data
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13619148.
http://andreasohlund.net http://twitter.com/andreasohlund
Seems so. See : https://github.com/ravendb/ravendb/blob/master/Raven.Client.Lightweight/DocumentStoreBase.cs Am 15.02.2013 um 20:02 schrieb Andreas Öhlund [email protected]:
@johnsimons Do you remember if ayende re-introduced the rm-id in Raven 2?
On Fri, Feb 15, 2013 at 6:56 PM, danielmarbach [email protected]:
We just detected it today again with the newest version of ravendb and multiple NSB hosts running on the same machine. We have the following setup:
RavenDB 2261 RavenPersistence for Saga On RavenDB DocumentStore for our domain data
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13619148.
http://andreasohlund.net http://twitter.com/andreasohlund — Reply to this email directly or view it on GitHub.
There was actually 2 bugs, and it seems like my patch only fixes one of them, So the bug still outstanding is the scenario where a user has 2 workers on the same machine, these would have the same Address.Local + semver and that would generate the same ResourceManagerId. But is this really a valid scenario?
@danielmarbach when you say multiple hosts running on the same machine, are these hosts running the same endpoint?
No we had two seperate endpoints running on the same machine. But they shared some assemblies of common infrastructure code.
Am 15.02.2013 um 23:50 schrieb John Simons [email protected]:
@danielmarbach when you say multiple hosts running on the same machine, are these hosts running the same endpoint?
— Reply to this email directly or view it on GitHub.
So is the IConfigureThisEndpoint that same for both of them or different?
On Saturday, February 16, 2013, danielmarbach wrote:
No we had two seperate endpoints running on the same machine. But they shared some assemblies of common infrastructure code.
Am 15.02.2013 um 23:50 schrieb John Simons <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>:
@danielmarbach when you say multiple hosts running on the same machine, are these hosts running the same endpoint?
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644349.
Regards John Simons NServiceBus
Different. But the ravendb initialization is shared
Am 16.02.2013 um 05:37 schrieb John Simons [email protected]:
So is the IConfigureThisEndpoint that same for both of them or different?
On Saturday, February 16, 2013, danielmarbach wrote:
No we had two seperate endpoints running on the same machine. But they shared some assemblies of common infrastructure code.
Am 15.02.2013 um 23:50 schrieb John Simons <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>:
@danielmarbach when you say multiple hosts running on the same machine, are these hosts running the same endpoint?
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644349.
Regards John Simons NServiceBus — Reply to this email directly or view it on GitHub.
That shouldn't matter, as long as the endpointname is differen, it should work, I can look at this on Monday. Any chance of sending us a repro?
On Saturday, February 16, 2013, danielmarbach wrote:
Different. But the ravendb initialization is shared
Am 16.02.2013 um 05:37 schrieb John Simons <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>:
So is the IConfigureThisEndpoint that same for both of them or different?
On Saturday, February 16, 2013, danielmarbach wrote:
No we had two seperate endpoints running on the same machine. But they shared some assemblies of common infrastructure code.
Am 15.02.2013 um 23:50 schrieb John Simons <[email protected]<javascript:_e({}, 'cvml', '[email protected]');><javascript:_e({}, 'cvml', '[email protected] <javascript:_e({}, 'cvml', '[email protected]');>');>>:
@danielmarbach when you say multiple hosts running on the same machine, are these hosts running the same endpoint?
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644349>.
Regards John Simons NServiceBus — Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644573.
Regards John Simons NServiceBus
When u say the raven initialisation is shared, u mean the raven db is the same? So u have different endpointnames but same raven database name ?
On Saturday, February 16, 2013, John Simons wrote:
That shouldn't matter, as long as the endpointname is differen, it should work, I can look at this on Monday. Any chance of sending us a repro?
On Saturday, February 16, 2013, danielmarbach wrote:
Different. But the ravendb initialization is shared
Am 16.02.2013 um 05:37 schrieb John Simons [email protected]:
So is the IConfigureThisEndpoint that same for both of them or different?
On Saturday, February 16, 2013, danielmarbach wrote:
No we had two seperate endpoints running on the same machine. But they shared some assemblies of common infrastructure code.
Am 15.02.2013 um 23:50 schrieb John Simons <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>:
@danielmarbach when you say multiple hosts running on the same machine, are these hosts running the same endpoint?
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644349>.
Regards John Simons NServiceBus — Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644573.
Regards John Simons NServiceBus
Regards John Simons NServiceBus
No, we only share the ninject module which pics up the connection string from the app.config. So each endpoint has its own database
From: John Simons [mailto:[email protected]] Sent: Samstag, 16. Februar 2013 07:00 To: NServiceBus/NServiceBus Cc: danielmarbach Subject: Re: [NServiceBus] RavenDB and ResourceManagerId (#578)
When u say the raven initialisation is shared, u mean the raven db is the same? So u have different endpointnames but same raven database name ?
On Saturday, February 16, 2013, John Simons wrote:
That shouldn't matter, as long as the endpointname is differen, it should work, I can look at this on Monday. Any chance of sending us a repro?
On Saturday, February 16, 2013, danielmarbach wrote:
Different. But the ravendb initialization is shared
Am 16.02.2013 um 05:37 schrieb John Simons < mailto:[email protected] [email protected]>:
So is the IConfigureThisEndpoint that same for both of them or different?
On Saturday, February 16, 2013, danielmarbach wrote:
No we had two seperate endpoints running on the same machine. But they shared some assemblies of common infrastructure code.
Am 15.02.2013 um 23:50 schrieb John Simons < mailto:[email protected]%3cjavascript:_e(%7b%7d,%20%0b [email protected]<javascript:_e({}, 'cvml', '[email protected]');>>:
@danielmarbach when you say multiple hosts running on the same machine, are these hosts running the same endpoint?
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644349 https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644349>.
Regards John Simons NServiceBus — Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644573 https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644573>.
Regards John Simons NServiceBus
Regards John Simons NServiceBus
— Reply to this email directly or view it on GitHub https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13645186 .
https://github.com/notifications/beacon/TUqL6p7Xz6SF-_dIEJ1YBCbEuZPiXFCgnme0ihbygamO9wW5l0bSR6gCn4TWCG09.gif
Lets log the rmid used so that we can make sure that its the same.
Sent from my iPhone
On 16 feb 2013, at 07:22, danielmarbach [email protected] wrote:
No, we only share the ninject module which pics up the connection string from the app.config. So each endpoint has its own database
From: John Simons [mailto:[email protected]] Sent: Samstag, 16. Februar 2013 07:00 To: NServiceBus/NServiceBus Cc: danielmarbach Subject: Re: [NServiceBus] RavenDB and ResourceManagerId (#578)
When u say the raven initialisation is shared, u mean the raven db is the same? So u have different endpointnames but same raven database name ?
On Saturday, February 16, 2013, John Simons wrote:
That shouldn't matter, as long as the endpointname is differen, it should work, I can look at this on Monday. Any chance of sending us a repro?
On Saturday, February 16, 2013, danielmarbach wrote:
Different. But the ravendb initialization is shared
Am 16.02.2013 um 05:37 schrieb John Simons < mailto:[email protected] [email protected]>:
So is the IConfigureThisEndpoint that same for both of them or different?
On Saturday, February 16, 2013, danielmarbach wrote:
No we had two seperate endpoints running on the same machine. But they shared some assemblies of common infrastructure code.
Am 15.02.2013 um 23:50 schrieb John Simons < mailto:[email protected]%3cjavascript:_e(%7b%7d,%20%0b [email protected]<javascript:_e({}, 'cvml', '[email protected]');>>:
@danielmarbach when you say multiple hosts running on the same machine, are these hosts running the same endpoint?
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644349 https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644349>.
Regards John Simons NServiceBus — Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub< https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644573 https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13644573>.
Regards John Simons NServiceBus
Regards John Simons NServiceBus
— Reply to this email directly or view it on GitHub https://github.com/NServiceBus/NServiceBus/issues/578#issuecomment-13645186 .
https://github.com/notifications/beacon/TUqL6p7Xz6SF-_dIEJ1YBCbEuZPiXFCgnme0ihbygamO9wW5l0bSR6gCn4TWCG09.gif — Reply to this email directly or view it on GitHub.