IIS 7 and Above
IIS 7.5 Application Pool Recycling Issues
Last post Dec 21, 2012 06:00 AM by Mamba Dai - MSFT
Dec 06, 2012 12:21 PM|buthfer_123|LINK
Hi, we are experiencing an issue with application pools not recycling at the time they have been designated. We have about 20 app pools running mainly .net 4 mvc sites and wcf service. All app pools have been configured to recycle at the same specific
time, and have been configured to log just such an event. Upon checking the event viewer only 2 or 3 had actually recycled at all. The problem seems to be manifesting itself by the applications then behaving in sometimes curious ways.
Does an application pool being shut down constitute a recyling of the application pool?
FYI, the server is 2008r2
Dec 06, 2012 01:14 PM|terridonahue|LINK
If an application pool is shutdown, it will not spin back up until a request is sent to the website again. This can lead to delays in the initial page loads. Here is a blog post related to enabling
application initialization for your application pools to ensure that they are always running.
Dec 06, 2012 01:19 PM|buthfer_123|LINK
Actually, I want the application pools to recycle. The question is does the worker process shuting down and a new process starting actually recycle the app pool.
Dec 06, 2012 02:58 PM|Rovastar|LINK
Is the app pool actually running (w3wp.exe running) when you schedule a recycle? IF not what are you expecting recycling to do?
Shutting down the worker process and restarting is similiar to recycling.
Dec 06, 2012 08:25 PM|buthfer_123|LINK
I am unsure if the process is running during the scheduled time for recycling of the app pool. Is there a way to determine this, as I say the event viewer is only showing a small fraction of the the pools being recycled. When you say "Shutting down
the worker process and restarting is similiar to recycling" what is meant by that? Would the HttpRuntime.Cache of a .NET app be affected, in the sense that garbage collection would be initiated and wipe the cache? Alternatively, will the cache remain
and possibly become corrupt?
Dec 06, 2012 09:39 PM|Rovastar|LINK
The cache will be in the worker process and if the worker process is not running there is no need for a cache.
An apppool recycle will kill a wp and recreate a new wp therefore it is similar to stopping and starting the only difference is that it will spin up the new wp first before killing the old one so the site is always available for the user.
Worker processes will close down if not being used and then there will be no cache, no in process session info, etc. You could work out if a wp is running at the time but it would be too much work for you going through IIS logs to get a working timeline
Dec 06, 2012 10:24 PM|buthfer_123|LINK
Could this "An apppool recycle will kill a wp and recreate a new wp therefore it is similar to stopping and starting the only difference is that it will spin up the new wp first before killing the old one so the site is always available for the user."
cause any issues with a cache, i.e. the old becoming part of the new. First thought is no, different thread, but as you say the new thread will spin up before killing the old one. To be fair I am grasping at straws now. This application had been running
happily in another environment for 3 years with little involvement, now it needs a manual app pool reset almost daily. Any other thoughts would be welcome.
Dec 06, 2012 11:21 PM|Rovastar|LINK
What exactly is your problem you have been having? it is not clear from your posts so far.
Dec 07, 2012 08:33 AM|buthfer_123|LINK
The exact problem is an application that has been running for 3 years in a different, albeit similar architecture with slightly older technology (iis 6, windows 2003), is becoming unstable and when a manual recycle of the app pool is performed it seems to
work for a day or two. It then becomes unstable and the same manual reset is required at some point. The app is scheduled to recycle at 4 in the morning and at 1740 mins, and switch off after 20 mins of no requests. The application relies heavily on the
data it caches and this is what is becoming corrupt. I am not saying it is 100% an iis problem, or the new environment. Just looking for plausible reasons for this problem and a way of reasolving it. The reason for my curiousity with the recycling of the
pool is that when it is carried out in a manually we get a stable application, when we leave it to the aformentioned processes it falls down.
Dec 17, 2012 05:33 PM|madpoo|LINK
The recycling options should work identically to doing a manual recycle. i.e. it will spin up a new process, killing the old one when that's done. You should make sure to enable the options to log an event whenever the app recycles, either
automatically or on-demand, so you can look in the event log and see exactly when. You can also examine the process itself using Process Explorer or similar to see how long it's been running and if it really seems like it started up when you expected. If
you have an app that maintains a persistent connection, I suppose it's possible that it's hanging on to the old process and when you recycle, it's not always giving up it's old connection and reconnecting to the new one? That would depend on the shutdown
options... if an app doesn't shut down after 30 seconds by default, it should terminate, but I haven't ever run across a scenario where I saw that exceeded by a long running thread.
Dec 21, 2012 04:55 AM|Mamba Dai - MSFT|LINK
Since we haven’t heard from you for 3 days, I am marking this thread now. If the marked reply
did not resolve your problem, please feel free to unmark the answer and let us know the error or problem. If you have further issue but different than the original one in this thread, please open a new question. Thanks for your cooperation.
Dec 21, 2012 06:00 AM|Mamba Dai - MSFT|LINK
Since we haven’t heard from you for 3 days, I am marking this thread now. If the marked replydid not resolve your problem, please feel free to unmark the answer and let us know the error or problem. If you have
further issue but different than the original one in this thread, please open a new question. Thanks for your cooperation.