Uncategorized

HashTable insert failed. Load factor too high

I already encountered a few recurrences of this errors and every time it has been a torture to capture a correct set of data (especially memory dumps) to review because this usually happens sporadically and you could have to wait weeks if not months before getting it again. There are a couple of hotfix available for this error message (see http://support.microsoft.com/default.aspx?scid=kb;EN-US;831730 and http://support.microsoft.com/default.aspx?scid=kb;EN-US;893314) but you already have them if you’re on the latest Service Pack for the .NET Framework.

Unless you’re using HashTable objects yourself… If that’s the case you might be running into a race condition which leads to the error, so you might want to consider to use the following code to synchronize the HashTable using SyncLock:

Dim MyHashTable as new Hashtable()
SyncLock MyHashtable.Syncroot
MyHashtable.Add (myKey, myValue)
End SyncLock

As an alternative you can use the Hashtable.Synchronized() method to return a synchronized (thread-safe) wrapper for the HashTable object.

 

Carlo

Quote of the day:

Everyone is a genius at least once a year. The real geniuses simply have their bright ideas closer together. – Georg Christoph Lichtenberg

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.