ninject/ninject — pull request #40 by shartte (2011-12-13 21:37:43+00:00)
Title: Fix for possible race condition in Planner.GetPlan

The current implementation of Planner.GetPlan uses double-checked locking on a Dictionary to retrieve a plan from the cache, which is not thread-safe. One of the use cases does lock the entire planner (KernelBase.Inject), preventing the race condition if Planner is only called from that method, but other methods call GetPlan without locking the planner first.

See here:
http://blogs.msdn.com/b/kimhamil/archive/2008/03/08/hashtable-and-dictionary-thread-safety-considerations.aspx
Another discussion of the topic:
http://www.grumpydev.com/2010/02/25/thread-safe-dictionarytkeytvalue/