Saturday, March 24, 2012

w3wp.exe 100% CPU

hi everyone,
I'm developing my website with asp with IIS and 2003 server. Today when I
did some test after editing my asp script, my browser just took forever to
load the page. Then I manually closed my browser and reopen it again for
testing. But the same thing happened again after a few more tests, for whic
h
it ended up my whole site was not responding. I found out that w3wp.exe
process took up 100% CPU usage that's why my whole site is not responding,
for which I have to restart my MSSQL server in order to work again.
I've searched around the Internet, and found out the possbile cause is my
inappropriated asp code, which leads the system runs into an infinite loop.
Now my question is I'm constantly changing my code, doing testing and
debugging all the times, so same thing may happen again (infinite loop)! If
I don't close my browser manually, and let it run until it times out, will
that free up the w3wp.exe and resume the site back to normal? Because I
don't want to restart my MSSQL server every time I have this problem cause i
t
will affect my clients at my website.
Please help me on this! Thanks alot!!!Jacky,
You should be able to test your code on your development machine running it
as a local web site first before you deploy.
Testing before deployment should find any problems. I also would recommend
using a code checker such as the free fxcop utility for .NET found here:
http://www.gotdotnet.com/team/fxcop/ It will run through your code and alert
you to any problems it finds and give suggestions for correcting them.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Jacky via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:53E37ADE4B0E5@.webservertalk.com...
> hi everyone,
> I'm developing my website with asp with IIS and 2003 server. Today when I
> did some test after editing my asp script, my browser just took forever to
> load the page. Then I manually closed my browser and reopen it again for
> testing. But the same thing happened again after a few more tests, for
> which
> it ended up my whole site was not responding. I found out that w3wp.exe
> process took up 100% CPU usage that's why my whole site is not responding,
> for which I have to restart my MSSQL server in order to work again.
> I've searched around the Internet, and found out the possbile cause is my
> inappropriated asp code, which leads the system runs into an infinite
> loop.
> Now my question is I'm constantly changing my code, doing testing and
> debugging all the times, so same thing may happen again (infinite loop)!
> If
> I don't close my browser manually, and let it run until it times out, will
> that free up the w3wp.exe and resume the site back to normal? Because I
> don't want to restart my MSSQL server every time I have this problem cause
> it
> will affect my clients at my website.
> Please help me on this! Thanks alot!!!
IIS6 has several features to help with this situation.
First thing you want to do is isolate your dev environment from the
production environment. This is best done using Application Pools. Create
and use a custom Application Pool when developing your code, and let the
rest run as production.
This allows you to do the following when you screw up code that runs in
w3wp.exe -- you can now RECYCLE the custom Application Pool running your dev
code WITHOUT affecting production code running in the other Application
Pools. The recycle will kill all the misbehaving w3wp.exe of the recycled
Application Pool.
Thus, if the w3wp.exe running your dev code has an infinite loop, just
recycle your dev App Pool and things should go back to normal.
If you do not want to manually recycle, you can configure additional
CPU-monitoring health metric on the dev Application Pool to automatically
recycle the application pool after it has reached a certain CPU% over a
configurable period of time. In other words, it is possible for you to tell
IIS to automatically recycle your dev application pool if it has been 100%
CPU for one minute -- so you can just keep working and IIS6 will just
recycle automatically.
There are many other health-monitoring metrics on IIS6 that do similar
behavior, and you can experiment and take advantage of all of them on your
dev Application Pool.
The key is to first isolate your potentially badly-misbehaving dev
application in its own Application Pool. Then, you can put many IIS6
features to work for you.
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Jacky via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:53E37ADE4B0E5@.webservertalk.com...
hi everyone,
I'm developing my website with asp with IIS and 2003 server. Today when I
did some test after editing my asp script, my browser just took forever to
load the page. Then I manually closed my browser and reopen it again for
testing. But the same thing happened again after a few more tests, for
which
it ended up my whole site was not responding. I found out that w3wp.exe
process took up 100% CPU usage that's why my whole site is not responding,
for which I have to restart my MSSQL server in order to work again.
I've searched around the Internet, and found out the possbile cause is my
inappropriated asp code, which leads the system runs into an infinite loop.
Now my question is I'm constantly changing my code, doing testing and
debugging all the times, so same thing may happen again (infinite loop)! If
I don't close my browser manually, and let it run until it times out, will
that free up the w3wp.exe and resume the site back to normal? Because I
don't want to restart my MSSQL server every time I have this problem cause
it
will affect my clients at my website.
Please help me on this! Thanks alot!!!
Thanks for the quick response! I will try it out~
So letting the browser times out instead of manually closing it before times
out will NOT solve the w3wp.exe spikes to 100% problem, am I correct?
Cause I found someone has similar problem but he/she said "When I execute so
m
asp code on my server, the process w3wp.exe uses 100% CPU. Then the browser
times out and the server runs normal again" Please correct me if I am wrong
.
Thanks again!
Jacky
S. Justin Gengo wrote:
>Jacky,
>You should be able to test your code on your development machine running it
>as a local web site first before you deploy.
>Testing before deployment should find any problems. I also would recommend
>using a code checker such as the free fxcop utility for .NET found here:
>http://www.gotdotnet.com/team/fxcop/ It will run through your code and aler
t
>you to any problems it finds and give suggestions for correcting them.
>
>[quoted text clipped - 20 lines]
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Fo...sp-net/200509/1
Jacky,
It all depends on the problem causing the spike. There are so many things
that can happen it's possible that what the other person is seeing could
happen, but be completely unrelated. In your case, if you really have
written an endless loop then the browser timing out won't help a bit.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Jacky via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:53E61AA9CDCC2@.webservertalk.com...
> Thanks for the quick response! I will try it out~
> So letting the browser times out instead of manually closing it before
> times
> out will NOT solve the w3wp.exe spikes to 100% problem, am I correct?
> Cause I found someone has similar problem but he/she said "When I execute
> som
> asp code on my server, the process w3wp.exe uses 100% CPU. Then the
> browser
> times out and the server runs normal again" Please correct me if I am
> wrong.
> Thanks again!
> Jacky
>
> S. Justin Gengo wrote:
>
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Fo...sp-net/200509/1
Justin Gengo,
Actually I am not sure whether my revised code caused the infinite loop or
not. Can you take a look? This is the portion of code that I added to my
script and then my browser stopped responding.
sql = "select * from VisitorCount a where ID='"&Request.Form("ID")&"'"
set DataRec=DataConn.Execute(sql)
if not DataRec.eof then
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.Open "MessageLog", DataConn, adOpenStatic, adLockOptimistic
application.Lock()
objRecordset.AddNew
objRecordset.Fields("Subject") = DataRec("Subject")
objRecordset.Fields("Message") = DataRec("Message")
objRecordset2.Fields("UpdatedDate") = now
objRecordset.Update
application.UnLock()
objRecordset.close
end if
DataRec.close
Also, besides infinite loop, is there any common reason to cause w3wp.exe
process spikes 100% of CPU?
Thanks!!
Jacky
S. Justin Gengo wrote:
>Jacky,
>It all depends on the problem causing the spike. There are so many things
>that can happen it's possible that what the other person is seeing could
>happen, but be completely unrelated. In your case, if you really have
>written an endless loop then the browser timing out won't help a bit.
>
>[quoted text clipped - 30 lines]
A quick question for you :
Why are you using ADO, instead of using ADO.NET ?
Could your problem be related to that ?
Juan T. Llibre
ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
==========================
"Jacky L via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:53F734D1BD38A@.webservertalk.com...
> Justin Gengo,
> Actually I am not sure whether my revised code caused the infinite loop or
> not. Can you take a look? This is the portion of code that I added to my
> script and then my browser stopped responding.
> sql = "select * from VisitorCount a where ID='"&Request.Form("ID")&"'"
> set DataRec=DataConn.Execute(sql)
> if not DataRec.eof then
> Set objRecordset = Server.CreateObject("ADODB.Recordset")
> objRecordset.Open "MessageLog", DataConn, adOpenStatic, adLockOptimistic
> application.Lock()
> objRecordset.AddNew
> objRecordset.Fields("Subject") = DataRec("Subject")
> objRecordset.Fields("Message") = DataRec("Message")
> objRecordset2.Fields("UpdatedDate") = now
> objRecordset.Update
> application.UnLock()
> objRecordset.close
> end if
> DataRec.close
> Also, besides infinite loop, is there any common reason to cause w3wp.exe
> process spikes 100% of CPU?
> Thanks!!
> Jacky
>
> S. Justin Gengo wrote:
Because my scripts are running ASP instead of ASP.NET. Is that anything
related? Thanks Juan!
Juan T. Llibre wrote:
>A quick question for you :
>Why are you using ADO, instead of using ADO.NET ?
>Could your problem be related to that ?
>Juan T. Llibre
>ASP.NET MVP
>ASP.NET FAQ : http://asp.net.do/faq/
>==========================
>
>[quoted text clipped - 36 lines]
Message posted via http://www.webservertalk.com
To ask ASP questions, please post at
microsoft.public.inetserver.asp.general
This is the ASP.NET newsgroup.
Juan T. Llibre
ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
==========================
"Jacky L via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:53FA1C711F79A@.webservertalk.com...
> Because my scripts are running ASP instead of ASP.NET.
> Is that anything related? Thanks Juan!

> Juan T. Llibre wrote:
>
> --
> Message posted via http://www.webservertalk.com

0 comments:

Post a Comment