Alex Mueller on Software and Technology 
Monday, November 19, 2007


Recently I was tracking down an unwanted error that has been recycling my application pool. One app pool recycling is one too many for me. The error details were useless, but a quick search put me on the right path. The error was the following.

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4 mscorlib, P5 2.0.0.0, P6 4333ab80, P7 bd0, P8 59, P9 system.nullreferenceexception, P10 NIL.

Searching for an error this cryptic reassured me that I need to take measures to improve the details of my error handling. As a result, I immediately created two HttpHandlers to deal with unhandled exceptions such as this one, and one for more generic error handling. By logging more detailed information, I can better detect the error and fix it. This is nothing new, but definitely important. A good article on reporting unhandled exceptions can be found here, ASP.NET 2.0 Unhandled Exception Issues.

After implementing this solution, my error reared its ugly head again, and a detailed error log was recorded. Perfect! As I am reading the detailed error message and stack trace, I am finding myself even more confused. Nothing in the stack trace could be found in my code. After another internet search, I found one dedicated thread specifically for this error. The error details are below.

System.NullReferenceException: Object reference not set to an instance of an object.
    at System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state)
    at System.Threading._TimerCallback.TimerCallback_Context(Object state)
    at System.Threading.ExecutionContext.runTryCode(Object userData)
    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading._TimerCallback.PerformTimerCallback(Object state) 

Closing the chapter on this error, the only thread I found with details on this can be found here, Null Reference Exception in SessionStateModule. The fix turned out to be a Microsoft hotfix that I had to install on my servers that basically updated the aspnet_wp.exe, System.Web.dll, and webengine.dll. With the fix in place, so far so good - no signs of the error after three weeks of peak usage.

Lessons Learned

Errors that occur outside of the main application context will cause the application pool to be recycled in ASP.NET 2.0 by default. While this default can be disabled, it is a better approach to throw more detailed information about each error. Using the unhandled exception HttpModule will help isolate errors that originate on threads outside of the application’s context. When catching errors, provide as much detailed information as possible to give yourself a fighting chance.

Monday, November 19, 2007 11:19:14 PM (Mountain Standard Time, UTC-07:00) | Comments [0] | Design#
Comments are closed.
MuellerDesigns.net
Search
On This Page
The Split Personality of the Tester/Developer
Cross Site Scripting (XSS)
Creating files with FSUTIL
PowerShell Management Library for Hyper-V
Installing Windows 7
Installing Linux in Hyper-V
Internet Explorer 8 Release Candidate 1
PowerShell Documentation
Automate Daily Tasks with PowerShell
SketchPath XPath Editor
Software Testing - Revisited
Architecting Buildings and Software
NBCOlympics.com with Silverlight
Marker Interfaces and C# Attributes
Most Popular
JavaScript ReplaceAll Functionality
What is polymorphism?
What is composition?
Sorting with IComparable and IComparer
Applying the Observer Pattern in ASP.NET
MVP in ASP.NET
What is abstraction?
What is encapsulation?
What is a class?
What is inheritance?
Authentication in ASP.NET
Calendar Controls
XPathNavigator.CheckValidity new for 2.0
SQL Server 2005 Connection Issues
Auto-attach to process '[####] aspnet_wp.exe' on m...
What is an object?
FreeTextBox
VMWare and VPC
An Example of Reflection using C#
Changing File Ownership In Vista and Longhorn
Archive
Links
Categories
My Local Blog Map
Blogroll
About
Powered by:

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
MuellerDesigns.net

Sign In

Help Those In Need
The Hunger Site
Ronald McDonald House Charities (RMHC) of Western Washington & Alaska