-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix for issue 26 (concurrency in RabbitMqUnitOfWork) #27
Conversation
Sweet, can you sign our CLA so we can pull this in? http://particular.net/contributors-license-agreement-consent |
I've already done that. |
Ok, my bad I've must have missed you in the list! Thanks! On Mon, Mar 31, 2014 at 12:30 PM, peuramaki notifications@github.comwrote:
|
Any chance of getting v1.2.0 out soon? This is a show stopper for us, but I'd still like to go with official packages. |
Thread static is not needed with ConcurrentDictionary. This is the fix, yes. There were two things I fixed in RabbitMqUnitOfWork:
My understanding of this working correctly now is based on the unit test part of the pull request and the separate test project (https://github.com/peuramaki/NServiceBus.RabbitMq.Issue26) |
Not following, we want all calls to bus.Sen|bus.Publish for the same message to add into the same "list" without a thread static you get a new one everytime and will execute: X times instead of 1 right?
Hmm, I need to understand this. What other thread is accessing the thread static of the message handling thread? |
It's
so there's just one instance, and thread safety is taken care of by ConcurrentDictionary. I'm not quite sure what other threads are touching the data, I was hoping to get an answer from you ;-) The issue only reproduces when I have DTC in play. I'd assume that it affects timing rather than triggers creating more threads though. You might want to debug through my unit test against the current RabbitMqUnitOfWork to see what happens. |
Doh, completely missed the static :) That said I'm still not thrilled about the concurrent dictionary since now I need to read up on how the concurrent dictionary works internally to Wonder where the concurrency comes from. I know that the DTC implementation On Tue, Apr 1, 2014 at 10:45 AM, peuramaki notifications@github.com wrote:
|
Yep, DTC commit on separate thread could explain the issue. I'm not quite following you about the serialization thing. Where would there be an extra serialization compared with the original code? Other than that, concurrent dictionary should do pretty well from performance point of view when there are multiple threads involved. |
Ok, I think I got it now, since the transactionCompleted event MAY fire on a separate thread https://groups.google.com/forum/#!topic/nhibernate-development/PZdMmC29ckY this means that the actions recorded in the thread static won't be available and we'll not be executing them against Rabbit. This means that we loose them! The fix is indeed to go with a static. We need to make the cleanup very robust to avoid memory leaks. We'll work on that! Thanks @peuramaki ! |
My pleasure. When can you let me know when v1.2.0 will be out? Like I said, this is a show stopper for us. |
We'll review it and test right away. Expect a release in the next few days On Tue, Apr 1, 2014 at 1:37 PM, peuramaki notifications@github.com wrote:
|
Ok, very good. I noticed that development branch references NSB core 4.5 alpha something. Should I expect to update NSB as well? We're currently with the latest stable (4.4.2). |
We're backwards compat so an upgrade to nsb 4.5 is not required Sent from my iPhone
|
Merged in 75aaf87 |
Hi @peuramaki Release is out now, thank you very much for the patch. |
RabbitMqUnitOfWork is fixed to support scenario where there are multiple concurrent, distributed transactions. Unit test
reproduces the issue.