umbraco.presentation.requestHandler doesn't seem to be thread safe. Any thoughts?
Hi All,
firstly, formalities:
Umbraco 4.7 (just upgraded from 4.6.1) IIS 6 (Live, testing), IIS 7.5 (development, testing) ASP.NET 4
We have been getting a lot of the following error, which i log in the Application_Error in a the global asax.
System.ArgumentException: Item has already been added. Key in dictionary: '/shop/browse-by-category.
aspx' Key being added: '/shop/browse-by-category.aspx'
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
- Hide quoted text -
at umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url)
at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I downloaded the source code and checked out the offending constructor and it seems that the line causing the problem is:
if (_processedRequests.ContainsKey(prefixUrl + url)) _processedRequests.Remove(prefixUrl + url);
the only hast table insert called in the method. And the Hash table is a static one for the requestHandler class.
Without knowing the inner workings of umbraco and their application architecture i can't fully comment on this but in a website a static hashtable isn't going to be thread safe unless dealt with appropriately.
Now i have no idea how this class really fits in to the whole scheme of things, and maybe under 'normal' conditions it's fine to add values this way, but out application is getting a log of 'Application Started' log events in the umbraco log table (last time i looked - 5 in 10 minutes, in some instances 2 in a second!!).
So it might be related to the fact that our application is restarting for some reason, we are unable to find out why as there is nothing helpful in the umbraco logs. Our log4net hasn't managed to show anything yet either - so we have just installed ELMAH to help find the problem(s).
umbraco.presentation.requestHandler doesn't seem to be thread safe. Any thoughts?
Hi All,
firstly, formalities:
Umbraco 4.7 (just upgraded from 4.6.1)
IIS 6 (Live, testing), IIS 7.5 (development, testing)
ASP.NET 4
We have been getting a lot of the following error, which i log in the Application_Error in a the global asax.
System.ArgumentException: Item has already been added. Key in dictionary: '/shop/browse-by-category.
at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
if (_processedRequests.ContainsKey(prefixUrl + url))
_processedRequests.Remove(prefixUrl + url);
******--> _processedRequests.Add(prefixUrl + url, currentPage.Attributes.GetNamedItem("id").Value);
the only hast table insert called in the method. And the Hash table is a static one for the requestHandler class.
Without knowing the inner workings of umbraco and their application architecture i can't fully comment on this but in a website a static hashtable isn't going to be thread safe unless dealt with appropriately.
Now i have no idea how this class really fits in to the whole scheme of things, and maybe under 'normal' conditions it's fine to add values this way, but out application is getting a log of 'Application Started' log events in the umbraco log table (last time i looked - 5 in 10 minutes, in some instances 2 in a second!!).
So it might be related to the fact that our application is restarting for some reason, we are unable to find out why as there is nothing helpful in the umbraco logs. Our log4net hasn't managed to show anything yet either - so we have just installed ELMAH to help find the problem(s).
Any comments greatly appreciated,
cheers
kle
is working on a reply...