Saturday, December 19, 2009

IIS Crash and Hang in SharePoint Websites

My this post truly relates to the people who are suffering with the IIS Crash/Hangs. You know IIS Processes have hanged or crashed when you see lot of Warning messages in the System Logs. The messages descirbes as "The process serving Application Pool "sharepoint_site" failed to respond. The Process Id is "xxxx". " If a series of such errors appear in your System Logs you should use some standard debugging tool to find out what is happening inside.

Basically an Application Pool is a verrtual space where all the requests receved in the server are pooled. The Processor based on it's processing algorithm serves all these request made from the client side computer. Untill then all these processes wait in Application pool. In order to serve any particluar query faster (to enable faster response time) a server uses memory from the buffer or the cache. But this buffer or the cache has a certain memory limit. All this memory allocated in the cache/buffer is in the form of Heap. Heap in particularly is not associated with any index and therefore when too many requests come and if the application is not designed properly the heaps starts overflowing or even fragmenting. This fragmenting in general happens when short term and long term heaps are stored and are not cleared from the application memory.

Now an old school thoery which has very much application in practical. Always free your obects when there use is over. Many developers think that the Sharepoint code comes under the managed code and therefore their is no need to dispose them! This is a mistake that they do because even though the code is from Managed Code the specific objects like the SPWeb and SPSite make reference to the unmanged portion of code which needs to be destroyed using IDisposable Interface.

Once a developer makes sure that all the code is disposed properly he should deploy the same in the server. To check the same he can use a standard tool my Microsoft --> "Dispose Check".

Confirm the same after deploying your modules from the 12 Hive logs.