Description
From @cglessner on October 14, 2012 7:30
I've a project called "IronSP" where I host the DLR (.net 2.0) and IronRuby in SharePoint/ASP.NET. During a load test I found a critical bug. I always got the following error while load testing (yout have to use arrays to cause the error):
"System.IndexOutOfRangeException: Index was outside the bounds of the array"
Wow, to hunt this bug has almost taken two weeks. The issue is that in the _infiniteTracker field in IronRuby.Runtime.RecursionTracker is missing the static keyword and without this keyword the [ThreadStatic] attribute is useless. Hosting the engine in ASP.NET means many threads will access the infiniteTracker dictionary and when two hits the _infiniteTracker in parallel the dictionary will be corrupted an every access to it throws a IndexOutOfRangeException. The static keyword in combination with [ThreadStatic] avoids this issue, because the dictionary will be created per Request/Thead. Please fix that in original IronRuby source. It affects the current version and IronRuby 1.0. Would be awesome if some one coud fixes in 1.0. I did the fix already, but can't sign the assemblies with the original MS keys.
class IronRuby.Runtime.RecursionTracker
[ThreadStatic]
private static Dictionary<object, bool> _infiniteTracker;
Copied from original issue: IronLanguages/main#87