Wednesday, October 11, 2006

Multithreaded Mayham, Cont.

Two posts ago, I elaborated on a bug we found in the .NET 2.0 CLR when attempting to spawn multiple threads at a lower priority than the spawning thread. However, I realized this morning that I didn't talk about what we did to actually address the bug in our code.

Short answer: we did the best we could, but really the only full-proof "fix" is for MSFT to release a patch or wait for the next version of .NET. Our fix amounted to protecting all of our BeginInvoke calls with a lock to prevent two of them from being called at the same time, which did fix the bug.

However, one issue with this fix is it still wouldn't address the same bug in third party code that we execute. There isn't much to be done about that. Because we rely on the CLR to function properly, and other code may use the offending code in the CLR, we're somewhat at the mercy of MSFT on this one, which is always scary, since they're an 800 lb. gorilla and we're something more similar to toe fungus.

No comments: