Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hashtable insert failed. Load factor too high. - asp.NET 4.0 MVC3

We have an ASP.NET 4.0 MVC3 application running on F5 load balanced servers.

We received the exception below. We do not do multi-threading in our web application, but don't know if the F5 load balancing servers could be factoring into the equation. We see where the exception occurs on earlier versions of .NET (Most of the other posts deal with .NET 2.0 and 3.5). Has anyone experienced this issue with .NET 4.0?

The exception rendered the application unusable because upon login no page could be loaded without encountering the exception.

Other links already reviewed:

  • Hashtable insert failed. Load factor too high. - ASP.NET 2.0
  • HashTable Insert Failed. Load Factor Too High. .NET 2.0 SP2
  • Frustrating error in WPF (.NET 4.0) internals: Hashtable insert failed. Load factor too high

2012-02-02 06:01:42,671 [26] FATAL System [(null)] – An unhandled exception occurred in the XYZ application. System.InvalidOperationException: Hashtable insert failed. Load factor too high. The most common cause is multiple threads writing to the Hashtable simultaneously. at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at System.ComponentModel.TypeDescriptor.NodeFor(Type type, Boolean createDelegator) at System.ComponentModel.TypeDescriptor.GetProvider(Type type) at System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptionProvider..ctor(Type type) at System.Web.Mvc.ModelBinderDictionary.GetBinder(Type modelType, IModelBinder fallbackBinder) at System.Web.Mvc.ControllerActionInvoker.GetModelBinder(ParameterDescriptor parameterDescriptor) at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) at System.Web.Mvc.Controller.ExecuteCore() at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.b__5() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.b__0() at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.b__d() at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

As you can see from the stack trace it does not point to a particular place in our code making it difficult to debug.

Any advice to prevent encountering this exception would be greatly appreciated.

like image 408
user1185361 Avatar asked Feb 02 '12 14:02

user1185361


1 Answers

This is an uncommon issue but it does happen for many people (me included). It does not seem to be linked with any specific load threshold, it just "happens" and once it does it continues to happen more frequently regardless of the load.
Solutions:
Temporary: Reset IIS and cross your fingers it doesn't happen again
Permanent: Get the patch from microsoft described in the KB article or wait for the next version of .Net where it is going to be fixed (it is reported to already been fixed in 4.5 Beta)

like image 110
Raul Vejar Avatar answered Sep 22 '22 17:09

Raul Vejar