J
jason sirota
I have a 3rd Party application that once a day or so runs into
thousands of ASP.NET exceptions. The callstack indicates that it only
occurs when running an IsMatch on a compiled regular expression. It
seems to reach a certain threshhold of memory usage and then crashes.
If anyone has run into this problem before, can you suggest ways of
rewriting the code or changing IIS memory settings in order to handle?
Here's the code:
Regex matchNotTLD = new Regex("[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)+
$",RegexOptions.Compiled|RegexOptions.IgnoreCase);
if( (matchNotTLD.IsMatch(cookieDomain)) &&
(currentURL.IndexOf(cookieDomain) > -1) )
Here is the exception stack:
System.OutOfMemoryException: Exception of type
'System.OutOfMemoryException' was thrown.
at Go153043(RegexRunner )
at System.Text.RegularExpressions.CompiledRegexRunner.Go()
at System.Text.RegularExpressions.RegexRunner.Scan(Regex regex,
String text, Int32 textbeg, Int32 textend, Int32 textstart, Int32
prevlen, Boolean quick)
at System.Text.RegularExpressions.Regex.Run(Boolean quick, Int32
prevlen, String input, Int32 beginning, Int32 length, Int32 startat)
at System.Text.RegularExpressions.Regex.IsMatch(String input)
at CommunityServer.Components.UserCookie.WriteCookie(HttpCookie
cookie, Int32 days, Boolean autoLogin)
at CommunityServer.Components.UserCookie.UpdateMostRecentActivity()
at
CommunityServer.Components.UserLastVisitModule.csa_UserKnown(User
user, CSEventArgs e)
at CommunityServer.Components.CSUserEventHandler.Invoke(User user,
CSEventArgs e)
at CommunityServer.Components.CSApplication.ExecuteUserEvent(Object
EventKey, User user, ObjectState state, ApplicationType appType)
at CommunityServer.CSHttpModule.Application_AuthorizeRequest(Object
source, EventArgs e)
at
System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)
thousands of ASP.NET exceptions. The callstack indicates that it only
occurs when running an IsMatch on a compiled regular expression. It
seems to reach a certain threshhold of memory usage and then crashes.
If anyone has run into this problem before, can you suggest ways of
rewriting the code or changing IIS memory settings in order to handle?
Here's the code:
Regex matchNotTLD = new Regex("[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)+
$",RegexOptions.Compiled|RegexOptions.IgnoreCase);
if( (matchNotTLD.IsMatch(cookieDomain)) &&
(currentURL.IndexOf(cookieDomain) > -1) )
Here is the exception stack:
System.OutOfMemoryException: Exception of type
'System.OutOfMemoryException' was thrown.
at Go153043(RegexRunner )
at System.Text.RegularExpressions.CompiledRegexRunner.Go()
at System.Text.RegularExpressions.RegexRunner.Scan(Regex regex,
String text, Int32 textbeg, Int32 textend, Int32 textstart, Int32
prevlen, Boolean quick)
at System.Text.RegularExpressions.Regex.Run(Boolean quick, Int32
prevlen, String input, Int32 beginning, Int32 length, Int32 startat)
at System.Text.RegularExpressions.Regex.IsMatch(String input)
at CommunityServer.Components.UserCookie.WriteCookie(HttpCookie
cookie, Int32 days, Boolean autoLogin)
at CommunityServer.Components.UserCookie.UpdateMostRecentActivity()
at
CommunityServer.Components.UserLastVisitModule.csa_UserKnown(User
user, CSEventArgs e)
at CommunityServer.Components.CSUserEventHandler.Invoke(User user,
CSEventArgs e)
at CommunityServer.Components.CSApplication.ExecuteUserEvent(Object
EventKey, User user, ObjectState state, ApplicationType appType)
at CommunityServer.CSHttpModule.Application_AuthorizeRequest(Object
source, EventArgs e)
at
System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)