Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP is being blamed help 5

Status
Not open for further replies.

brad10

Technical User
Jun 5, 2001
33
GB
I maintain an intranet site which is hosted on NT4 running IIS. Our IT dept manage the server.

Recently the publishing service on the server keeps stopping. I can't see any pattern in the occasions when it stops. Our IT dept can't work it out and just keep restarting the service when it stops. This has been going on for a few weeks.

I'm now being blamed for 'sloppy code' as they can't find another reason. However I think my asp code is fine. No pages are erroring as far as I can tell.

Does anyone know if bad code can stop the service? I've been told by someone else that it can't as its run in a different memory address to the IIS Service for security reasons, so ASP doesn't have any direct connection with the IIS Service?

Can anyone help me - I think I'm taking the rap because others can't find an answer.
 
[tt]The only problems I've ran in the past, is that for reasons and the systems (networking) department can't expaling, some of my pages sometimes do not work is due to the SQL database stoping all of the suddent.



Delete * from brain Where MaxLevel = "Full" and reaction = "Slow" order by StartOver
 
The only code problem I can think of that might cause issues is if you have left database connections open in your code. In all pages where you have opened a database connection, check to be sure there is a
<dBname>.Close
and
Set <dBname> = Nothing
on the page
 
I've seen that problem before as well, and it was attributed to a faulty com object. Try looking at the weblogs and see if you are getting a lot of HTTP 500 requests before the crash. That might point you to the problem script(s).
 
I have to second BHaines suggestion. Not closing your connections can stop the service.

Something else that can cause this is if another computer on your network is using the same IP address as your IIS server. I am suggesting this because believe it or not it happened in an IT Dept. I worked in. Too many hands in the pot. Does your company use static IP's? If so, you may want to check this out. Next time the IIS Service stops open a command prompt and type:
nbtstat -a 'IIS Servers IP' so if the IP is 111.111.1.111 the command should be typed like:
nbtstat -a 111.111.1.111

This will show you the computer that us using this IP and the person logged in.
 
Thanks for all the help so far. I'll look into all suggestions 2moro.

A few people have mentioned the faulty com object issue - what does this mean and how exactly do I go about finding out if this is the problem?
 
Actually, poor/bad codes CAN crash an IIS server ... it does not need to cause an 'ERROR' to crash it and really, if your code shows an error, chances are it will not crash it.

The times when codes crashes an IIS is normally due to poor resource management (both memory and processor).

For example, if your code goes into an infinite loop and you have many sessions running that same page. Since this is a logic error, There is no hard 'error message', but since it goes into an infinite loop, it may take a lot of processing power and having many sessions like at the same time will cause your server to be unstable. One way to catch this is to monitor the Server's [Task Manager] to see if the server hits 100% CPU utilization (and maintains there for a long while) before crashing.

As for memory, it is important to know that as default, IIS maintains each session for 10 (or is it 20 --can't remember) minutes before killing the session. Therefore, any objects that you create in your code but not destroyed when you code ends might be lingerring in your system (ie, any session variables). As this is also a logic error, it will be tough to catch, so, it is important to explicitly
SET whateverObjectYouCreated = NOTHING
before exiting your ASP code.

Just my 2 cents :) Also in IIS, you can limit the processing power consumed by each 'site' and you might want to get your IT dept to set that to test.


regards,
- Joseph
=====================


~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
 
fhlee,

Thanks for that - can I just clarify that you class crashing as the service on the server stopping?

The server doesn't go down or anything - the service just stops and is then manually restarted.

It does the same on a back up server which isn't connected to the main server in anyway apart from some replication which is done manually using a bat file. The services stop randomly though sometimes both go sometimes just the one of them.
 
Also check and see if your system and application event logs have anything useful to say.

codestorm
Newbie Life Member.
Fire bad. Tree pretty. - Buffy
<insert witticism here>
 
brad10,
Sorry, I used the term loosely. My 'Crashing' means that the server is no longer responding to clients (browsers) or that the server is responding very slowly. And it definately will work again after you stop/start it again as it force clear whatever IIS was doing (or force release whatever resources that are being held up).


regards,
- Joseph
==================

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
 
Brad...
A lot of what has already been said should resolve both issues. ASP operates off the kernal on NT servers. If a page doesn't clear objects out of memory they are retained there as long as the service is active. As well as checking for proper closing of your database make sure you also destroy any instances of ADO objects you've created. I usually use this function call to clear memory.

Function CloseDB()

On Error Resume Next
Rs.Close
Rs2.Close
Cn.Close
Set Rs = Nothing
Set Rs2 = Nothing
Set Cn = Nothing

If err then
err.clear
End If

End Function

I include two instances of variables of recordsets to close incase I need two opened while processing my page. The on error routine insures all lines for closing are passed even if one doesn't exist.
 

Thanks to everyone for their suggestions.

I've checked all pages and all close connections statements are ok.

I was wondering though if a user (or possibly several users) leaves a page (connection to dB) open all day, could this cause the sort of problems that we're talking about?

There's a pop up poll on the site which users may be opening and leaving open just to view the results?
 

Someone has suggested that it may be a problem with MTS if our IT dept are using it. I'm beginning to understand that this would be linked to what baddos said about a faulty COM object??

Does anyone know the details of MTS problems that could cause this? Anyone experienced it before?
 
Where are the stars? Well, I gave BHaines a star since I (lamentably) had not been closing my object variables at the end of my pages. Right now, today not tomorrow, I've got to add &quot;SET obj = Nothing&quot; to a lot of pages...
 
I'm unclear on one thing; when the service stops serving pages...
1. are ALL pages (including HTML and images) no longer served, or only ASP pages? (i.e. is ASP.DLL involved or not).
2. are only pages that actually hit a database effected, or any 'ol ASP page? (e.g. is the problem related MDAC/ADO/ODBC or ASP.DLL).

The fact that this occurs on seperate IIS servers strongly suggest it's either the IIS configuration (same on both servers?) or faulty ASP code.

If ALL files are no longer served, it's more likely to be a configuration problem than the code. Hope this helps.

Often, asking the right questions is half of the answer.
 
>> Recently the publishing service on the server keeps stopping.

Please clarify stopping. It shows no status in the Services Management Console?

If that is the case i have never seen any web application problem cause that to happen.

If it needs to be stopped and restarted because it stops serving pages, do you have your application running in an isolated process. That setting will usually at least allow other sites on the server to be available.

Not closing ADO connection objects should not crash your web application. It can slow it to a crawl but it should not result in a crash.

As mentioned in a previous posts, misbehaving or misused ActiveX controls and infinite loops in your ASP code are the most frequent causes of applications crashing.


-pete
 

lottastuff - it's as though someone has manually stopped the web service on the server - but they haven't. It doesn't publish any pages through the browser. The servers fine, you can ping it and I can view file directories on my machine through a mapped drive etc.

It's then just started again through the management console and works fine for an indefinite amount of time.

I believe the IIS configuration is identical on both. The service has stopped on both servers - sometimes both in the same day, sometimes just the one. Somedays they're both fine!
 
Heh just a quick suggestion, but make sure your asp website is running in it's own process space.. That way it will only kill itself and not iis.

I think the option is &quot;High&quot; in the iis server manager..

If it is your site that dies and not iis then it is your code or some com object.

If iis dies, something else is causing it.

Rob
 
Palbano - I'm told it shows no status in the console when it goes down.

Sometimes it goes down again a minute after it is restarted. I wouldn't have thought that an infinite loop in code would act so quickly after the service is restarted? But then again I can't think of anything that would act so randomly. Like I've said before though sometimes it goes for days or even a couple of weeks without a problem.

I've tested each and every page and nothing it causing immediate shutdown when viewed?
 
NoCoolHandle has it right. Isolate your website/application by using the MMC to set it so that it runs in it's own process space. Although this most likely will not get you any closer to a solution, it should make you some points with the server administrator who propbably sees your website as a pain-in-the-butt by now.

As NoCoolHandle says, it MIGHT provide the clue needed to absolve your application and/or the COM objects it uses. BTW, I don't think you've mentioned what (if any) COM objects you are using.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top