Hashtable insert failed. Load factor too high. - A

2019-01-15 14:57发布

问题:

I received the following error while trying to login to a secured directory. As far as I know there are no large hashtables in use. The user login information is in the web.config file. Notice this is happening in .NET 2.0. I've searched and found references to this occurring in .net 1.0 or 1.1 environments but I haven't found a solution for it happening in 2.0+.

I need to figure out why this happened so I can avoid it in the future. I could just reset the server and maybe it goes away but I would prefer to understand why it happened.

Here is the entire error page as shown:

Server Error in '/' Application.

Hashtable insert failed. Load factor too high.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Hashtable insert failed. Load factor too high.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Hashtable insert failed. Load factor too high.] System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +2903977 System.Collections.Hashtable.set_Item(Object key, Object value) +11
System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetAttributes(Type type) +323
System.ComponentModel.ReflectedTypeData.GetAttributes() +36 System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetAttributes() +50 System.ComponentModel.TypeDescriptor.GetAttributes(Type componentType) +26
System.Web.UI.ThemeableAttribute.IsTypeThemeable(Type type) +98
System.Web.UI.Control.ApplySkin(Page page) +49
System.Web.UI.Control.InitRecursive(Control namingContainer) +2120286
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +834

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

回答1:

The following hotfix addresses this (and other) issues.

http://support.microsoft.com/?id=927579

(information sourced from here)



回答2:

In .NET 4.0, this same bug reappeared; it was fixed in a hotfix with KB:2576011. It may now be rolled up into standard updates (haven't checked), but: a hotfix for 4.0 is available from MS if needed.



回答3:

I've had a similar issue, outlined here: HashTable Insert Failed. Load Factor Too High. .NET 2.0 SP2

However, the 927579 hotfix was included in .NET 2.0 SP1 ( http://support.microsoft.com/kb/945757 ) and we still got the same issue as listed above. Hopefully the newer hotfix ( http://code.msdn.microsoft.com/KB968432 ) will resolve it once and for all.

I can't vouch for it as I haven't had chance to install it on our server yet, and considering we haven't had a recurrence of the problem after the last time then even if it had been installed I wouldn't be able to say whether it works or not!