ASP.NET Restart Problem

G

Guest

We are experiencing the following problems concerning ASP.NET: our
ASP.NET application, written in .NET 1.1 platform, and hosted in IIS 5.0
environment, experience frequent session timeout problem. After tracing, we
find that it should be caused by "ASP.NET Application Restart" (proved by
incremented counter for "Application Restarts" of "ASP.NET 1.1.4322" in
"Performance" whenever the timeout happens).

From MSDN documentation, we find that the possible reasons are:
- changes in web.config or machine.config
- changes in files in \bin folder
- new folder under web application folder
- changes of files under web application folder
Besides, MS KB also tells us of the possible effect of anti-virus
product. However, we have eliminated the above factors (no files added /
modified, anti-virus product shut down), and the problem remains.

So, we want to ask for the following:
1. We want to know the exact / detailed reason why asp.net application
would restart (e.g. if caused by files changes, which file? what application
changes that file?), is there any place / log file we can find for that?
2. is there any reason behinds those listed above that would cause the
restart?
3. Any method to turn off the ASP.NET restart function
4. If it is turned off, what will be the side effect

The following is more details of the OS environment:
- Windows Server 2000 Sp4 (Eng.)
- .NET 1.1 (no hotfix applied explicitly unless downloaded through windows
update)
- IIS 5.0 (no hotfix applied explicitly unless downloaded through windows
update)
 
A

Alvin Bruney [MVP]

have a look at your application log on the webserver. it lists the reason
for the asp.net process restart.
 
G

Guest

Hi Alvin,

Thank you for your reply. But what source should we look at? Is it "ASP.NET [Version No]" (our version no is 1.1.4322.0)? Our problem - ASP.NET AppDomain Restart - does not make a new entry there of this source. Should we configure any switch to turn this logging on?

Regards,
Patrick

Alvin Bruney said:
have a look at your application log on the webserver. it lists the reason
for the asp.net process restart.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
amdishigh said:
We are experiencing the following problems concerning ASP.NET: our
ASP.NET application, written in .NET 1.1 platform, and hosted in IIS 5.0
environment, experience frequent session timeout problem. After tracing,
we
find that it should be caused by "ASP.NET Application Restart" (proved by
incremented counter for "Application Restarts" of "ASP.NET 1.1.4322" in
"Performance" whenever the timeout happens).

From MSDN documentation, we find that the possible reasons are:
- changes in web.config or machine.config
- changes in files in \bin folder
- new folder under web application folder
- changes of files under web application folder
Besides, MS KB also tells us of the possible effect of anti-virus
product. However, we have eliminated the above factors (no files added /
modified, anti-virus product shut down), and the problem remains.

So, we want to ask for the following:
1. We want to know the exact / detailed reason why asp.net application
would restart (e.g. if caused by files changes, which file? what
application
changes that file?), is there any place / log file we can find for that?
2. is there any reason behinds those listed above that would cause the
restart?
3. Any method to turn off the ASP.NET restart function
4. If it is turned off, what will be the side effect

The following is more details of the OS environment:
- Windows Server 2000 Sp4 (Eng.)
- .NET 1.1 (no hotfix applied explicitly unless downloaded through windows
update)
- IIS 5.0 (no hotfix applied explicitly unless downloaded through windows
update)
 
S

Steven Cheng[MSFT]

Hi Patrick,

As for the asp.net application restart problem. Yes, the reasons you listed
in the first message covered almost all the general causes. In addition,
you may also have a look at the <processModel> setting in the
machine.config file and the this element has some certain attributes for
example, the
1. responseDeadlockInterval attribute which specifies the time interval,
in standard process model format (hr:min:sec), after which the process will
be restarted if the following conditions are met:
a.There are queued requests.
b.There has not been a response during this interval. The default is 3
minutes.

2.memoryLimit attribute which specifies the maximum allowed memory size,
as a percentage of total system memory, that the worker process can consume
before ASP.NET launches a new process and reassigns existing requests. The
default is 60 percent. If the application's memeory use exceed this
limitation, the application will also restart.

#<processModel> Element
http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfProcessmodelSecti
on.asp?frame=true

In addition, generally such application restart behavior may have some logs
info in the Server's EventViewers. You can have a further check in the
Application node of the EventViewer to see whether it can provide any
clues. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
G

Guest

Hi Steven,

Thx for your reply. Concerning the "processModel" setting, is this controlling the "worker process" restart and/or application restart? From my understanding, it would lead to worker process start but not application restart; and my monitoring shows we are experiencing session timeout coz of application restart.

For the "application log" in event log, what source should we monitor for? Is it "ASP.NET [version]"? Searching for this yields not much result; the only entries we found are "asp.net unexpectedly ended" that appear when aspnet_wp.exe is killed in task manager. If that's not the correct source, what else should we look at? We are getting quite many / frequent new entries in application log so it would be quite difficult to locate the exact entries should the source not known.

Thank in advance!
 
S

Steven Cheng[MSFT]

Hi Patrick,

Thanks for your followup. Yes, the <processModel> limitations I mentioned
is concerned with asp.net process's recycle issue. Since you mentioned that
your application only restart the application domain, yes? How do you find
this behavior? Just by noticing that the sessionstates are lost?
I think you can try adding some codes in the Global object's
Application_Start event and write a log file to see whether the application
is really random restarted and also the Server.GetLastError api may help
provide some info on whether there is any error at that time.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
S

Steven Cheng[MSFT]

Hi Patrick,

Since you found that the "Application Restart" counter increase in your
performance monitor, how much is its top value? Also, are there many other
asp.net web applications running on this machine? The "Application Resart"
counter may log all the applications on the server's restart event.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
G

Guest

Hi Steven,

The server host two ASP.NET application; and two of them exhibit the same session timeout problem. And the counter value would keep incrementing until the server is rebooted. The top value we have noticed of is around 80 times. One more thing worth to mention is that the "worker process restart" is always very low (always 0; seldom incresed to 2 -3); so i think we can eliminate the chance that the session timeout is actually caused by worker process restart but mistakenly thought as caused by application restart?

Regards,
Patrick
 
S

Steven Cheng[MSFT]

Hi Patrick,

Thanks for your reply. Then, are there any unhandled exceptions occur in
the applicatoin? As far as I know ,when there is unhandled exception occur
in application, the current session will also ended and a new one start.
In addition, does the problem occur when you're visiting some particular
pages in the application? Or is that any particular operations in the web
application which is possbile to cause the restart?


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
G

Guest

Hi Steven,

What type of "unhandled exception" would trigger this? We've experienced some type of unhandled exception in our application that would cause the notorious yellow error page (showing the details what errors occured and where) to appear. Is there some other more serious exception that would trigger the application to restart? And, in that case, is there any exception handler that can be defined on the application, like in global.asax, that can capture such unhandled exception? Thank you very much!

Regards,
Patrick
 
G

Guest

Hi Steven,

Besides, do you mean that the lost session maybe due to unhandled exception but not because of application restart? If that's the case, can you provide some clues to me on how to toruble-shoot those application restart (that we've recorded happened 80 times in maximum in one machine session)? Thanks!

Regards,
Patrick
 
S

Steven Cheng[MSFT]

Hi Patrick,

Thanks for your followup. I think we've got the most important point, as
you mentioned in the last reply that
=====================
We've experienced some type of unhandled exception in our application that
would cause the notorious yellow error page (showing the details what
errors occured and where) to appear.Is there some other more serious
exception that would trigger the application to restart?
=====================

No any serious unhandled exception will surely cause application to
restart. But as far as I know, when the unhandled exception occur, if you
don't manually handle it in Application_Error event and process it. The
current context's SessionState will be ended and a new one is started. I
think you can have trace on the session. For example turn on the Trace and
watch the SessionID before and after an unhandled exception occurs(the
yellow error page ), you may found the sessionId be changed.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
G

Guest

Hi Steven,

We are currently coding the corresponding error handler according to your suggestion; and would report back the progress later. Thx for your help!

Regards,
Patrick
 
G

Guest

Hi Steven,

After implementating the error handler as your suggestion, we've get the
following logging:

14/8/2004 12:23:41 :
Source: System.Web
Message: Exception of type System.Web.HttpUnhandledException was thrown.
Stack Trace:
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
Method Name: HandleError
HelpLink:
Inner Exception Source: qcmebnjq
Inner Exception Message: Object reference not set to an instance of an
object.
Inner Method Name: __Render__control1
Inner Exception HelpLink:
Base Exception Source: qcmebnjq
Base Exception Message: Object reference not set to an instance of an object.
Base Exception HelpLink:

14/8/2004 12:35:52 :
Source: System.Web
Message: Exception of type System.Web.HttpUnhandledException was thrown.
Stack Trace:
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
Method Name: HandleError
HelpLink:
Inner Exception Source: System.Web
Inner Exception Message: Maximum request length exceeded.
Inner Method Name: GetEntireRawContent
Inner Exception HelpLink:
Base Exception Source: System.Web
Base Exception Message: Maximum request length exceeded.
Base Exception HelpLink:

For the coding of the error handler, please refer to appendix.

The "Session Timeout" problem has occured numerious time, but there is
only one exception logged above (actually we don't know if the first
exception is related to session timeout problem). The second exception is
logged when the documents to be uploaded is larger than the asp.net limit.

Another observation we've got is that the Session Timout problem occurs
more frequently when there is more people using our application. When only 1
- 2 people using our application, the problem occurs rarely. But when more
than 5 people using the system, it would take just a few minutes to have the
problem reproduced.


Regards,
Patrick

Appendix:
protected void Application_Error(Object sender, EventArgs e)
{
// Logging the session
string REGKEYPATH="Software\\Vitova\\VitalDoc\\4.0";
RegistryKey
_appRegHandle=Registry.LocalMachine.OpenSubKey(REGKEYPATH,false);
object obj=null;
string AppErrLog ="0";

System.IO.StreamWriter sessionLog=null;
string ErrMsg="";

if (_appRegHandle != null)
{
obj=_appRegHandle.GetValue("AppErrLog");

if (obj != null)
{
AppErrLog = obj.ToString();

if (AppErrLog == "1")
{
sessionLog=new System.IO.StreamWriter("C:\\AppErrLog.log",true);

ErrMsg = System.DateTime.Now.ToString() + " : " +
GetErrLogStr(Server.GetLastError());
//ErrMsg += "Message: " + Server.GetLastError().Message;
//ErrMsg += Server.GetLastError().HelpLink;
sessionLog.WriteLine(ErrMsg);
sessionLog.Close();
sessionLog=null;
}
}
}

}

public static string GetErrLogStr(System.Exception e)
{
string ret = "";
ret += System.Environment.NewLine;
ret += "\tSource: " + e.Source;
ret += System.Environment.NewLine;
ret += "\tMessage: " + e.Message;
ret += System.Environment.NewLine;
ret += "\tStack Trace: \n" + e.StackTrace;
ret += System.Environment.NewLine;
if (e.TargetSite != null)
{
ret += "\tMethod Name: " + e.TargetSite.Name;
ret += System.Environment.NewLine;
}
ret += "\tHelpLink: " + e.HelpLink;
ret += System.Environment.NewLine;
if (e.InnerException != null)
{
ret += "\tInner Exception Source: " + e.InnerException.Source;
ret += System.Environment.NewLine;
ret += "\tInner Exception Message: " + e.InnerException.Message;
ret += System.Environment.NewLine;
if (e.InnerException.TargetSite != null)
{
ret += "\tInner Method Name: " + e.InnerException.TargetSite.Name;
ret += System.Environment.NewLine;
}
ret += "\tInner Exception HelpLink: " + e.InnerException.HelpLink;
ret += System.Environment.NewLine;
}
ret += "\tBase Exception Source: " + e.GetBaseException().Source;
ret += System.Environment.NewLine;
ret += "\tBase Exception Message: " + e.GetBaseException().Message;
ret += System.Environment.NewLine;
ret += "\tBase Exception HelpLink: " + e.GetBaseException().HelpLink;
ret += System.Environment.NewLine;

return ret;
}
 
S

Steven Cheng[MSFT]

Hi Patrick,

Thanks for the followup. As you mentioned that
=======================
The "Session Timeout" problem has occured numerious time, but there is
only one exception logged abov
=======================
Then, I think you can also add some logging code in the Global object's
Session_Start and Session_End event (or even the Application_Start/End)to
see whether the occurence rate is match. Also, since the problem occur more
frequently when the visited user increase, are there any code in the
application that has strong concerns on concurrency?


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
G

Guest

Hi Steven,

I would let you know the result when the testing is done. Besides, as far
as i know, there should be no concerns on concurrency on our code. But is
there any better way to diagnose / locate concurrency-related problem in our
code?

Regards,
Patrick
P.S. I know that there is a SP for .NET 1.1 under beta status, would you
think applying it would help to fix our problem? Thx.
 
S

Steven Cheng[MSFT]

Hi Patrick,

Thanks for the reply. As for the concurrency issue, there hasn't any
thorough troubleshooting means. Generally, we should take care of those
particular resource management code in our application such as
db manipluate, file manipulation or using any components. For example,
serverside automation may often cause concurrency issue.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top