---------- Forwarded message ---------- From: MattFenelon <reply+i-1167877-9ddfd49238cd38b56b14b17ff4c725f527d5c...@reply.github.com> Date: Tue, Jul 5, 2011 at 8:15 AM Subject: [Castle.Windsor] Thread safety in IWindsorContainer (#12) To: [email protected]
This pull request includes a test that reproduces the threading bug that was asked about in [this thread](http://groups.google.com/group/castle-project-users/browse_thread/thread/6f6edd7718c411c/8458fca93c8d09bd?lnk=gst&q=mattfenelon#8458fca93c8d09bd) in the Castle Project Users mailing list. Unfortunately because the bug is caused by a race condition the test doesn't always fail and it may take a number of runs before it will go red. What I've noticed is that the IWindsorContainer.Register(Component.For...) methods are locked and as such don't suffer from this problem. Whereas the methods OpenRasta is using, and the methods I'm using in the test, don't include locking. Is this by design? We are running v2.1.1 of Windsor. My analysis of the problem in that version is: in the situation where you have two components, foo and bar, if foo is registered before bar but has a dependency on bar, it's handler will be set to the waiting dependencies state. If bar is then added, foo will be informed via the RaiseHandlersChanged event, at which point it will remove bar as a waiting dependency. If a second thread is also registering components and raising the RaiseHandlersChanged event, the handler for foo can attempt to remove bar as a waiting dependency twice. If the test is run against the latest HEAD of the master branch in GitHub it still fails but with a different error. I've not had a chance to track down why it's failing yet. -- Reply to this email directly or view it on GitHub: https://github.com/castleproject/Castle.Windsor/pull/12 -- Cheers, hammett http://hammett.castleproject.org/ -- You received this message because you are subscribed to the Google Groups "Castle Project Development List" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en.
