Solved

dllhost.exe taking 100 Percent CPU Utilization

Posted on 2004-04-18
29
8,522 Views
Last Modified: 2010-08-05
Experts,
I have a big problem, We have developed a web application that is running on Windows 2000 server SP4, and IIS 5. Every now and then the application goes down, the browser keeps on calling the page with no response. The web server administrator informed us that the application which is running in an isolated dllhost.exe is taking 100% cpu usage. When we inspected the IIS logs we found the following ASP_0147|Internal server error in the logs. The problem is solved by running iisreset or just by stopping and restarting the Com Application from the component services, Please note that the only logs availabe in the IIS logs we can not deploy any debugging tools on the server :(
I can post a piece of code that shows what we do if you want

Help is greatly appreciated.
0
Comment
Question by:ko78
  • 9
  • 6
  • 3
  • +5
29 Comments
 

Author Comment

by:ko78
ID: 10853328
Sorry about that :)
It's not an exe it's a web application, Written in ASP

Thanks
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10854515
The can only suggest a scenario that causes this type of behaviour - infinite loops, more often a nested loop (do..loop), typically the inner loop goes around and around and around - you get the idea - left long enough it will bring the server to a grinding stand still.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10854726
Most often, it is because you are iterating through a recordset, and you forget to use the .MoveNext() on the recordset. That will result in the infinite loop and the gobbling of resources.

Fritz the Blank
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10855981
:(

Damb - forgot to mention that bit.
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10857147
There are some more factors that could cause the same problem.
String Concatenations. If you perform large string concatenations, the CPU goes for a toss and mostly you will have to end up restarting the IIS.

Another thing would be the fact that you have not destroyed all the objects created. Especially if you create objects in a loop and doesnt destroy them by setting them to nothing.

Another important consideration would be the threading model of the DLL. Make sure the component is not apartment threaded and that you havent created the object with session /application scope.

Cheers!!
0
 

Author Comment

by:ko78
ID: 10858114
Lord_McFly & fritz_the_blank
I have no loops at all in the page :( I wish I had, all what the page do is checking for the user priviliges from the database and show the links he should use, these links are considered the entry points to the application.

e.g.
AuthorizedToCreate      = CanCreateNewRecPac(creatorID)

And here's the function
Function CanCreateNewRecPac(ByVal userID)
      Call LogThisMessage(userID,"- " & pageName & " Entered CanCreateNewRecPac Function$$F$$")
      On Error Resume Next
      dim strSQL
      dim rs
      
      if cstr(userID&"") = "" then userID = "-5"
      ' 1.BU HR 2.BU HR SUB GROUP 3.CORPORATE COMPENSATION MANAGER
      strSQL      =       " SELECT * FROM USER_ROLES WHERE (FLG_BU_REP =1 OR FLG_BU_SUB_REP =1  OR FLG_CORP_COM_MANAGER = 1 OR FLG_CORP_COMP_DIRECTOR = 1) AND (UPPER(USER_ID) = " & toSQL(ucase(trim(userID)),"String") & " )"
      Call LogThisMessage(userID,"- " & pageName & " SQL Query: " & strSQL)
      call openrs(rs, strSQL)
      if err.number <> 0 then
            Call LogThisMessage(userID,"- " & pageName & " ERROR OCCURED IN QUERY EXECUTION:" )
            Call LogThisMessage(userID,"- " & pageName & " =====START OF ERROR LOGGING=====")
            Call LogThisMessage(userID,"- " & pageName & " ERROR NUMBER:" & err.number)
            Call LogThisMessage(userID,"- " & pageName & " ERROR DESCRIPTION:" & err.Description)
            Call LogThisMessage(userID,"- " & pageName & " ERROR SOURCE:" & err.Source)
            CanCreateNewRecPac = false
            Call LogThisMessage(userID,"- " & pageName & " =====END OF ERROR LOGGING=====")
            call DisplayError (Err.Description)
      else
            Call LogThisMessage(userID,"- " & pageName & " Query was executed successfuly")
            if rs.eof then
                  CanCreateNewRecPac = false
                  Call LogThisMessage(userID,"- " & pageName & " Query returned empty RS and function was set to false")
            else
                  CanCreateNewRecPac = true
                  Call LogThisMessage(userID,"- " & pageName & " Query returned result and function return was set to true")
            end if
      end if
      On Error Goto 0
      If rs.State = 1 Then
            rs.close
            Call LogThisMessage(userID,"- " & pageName & " rs was Closed")
      end if
      set rs = Nothing
      Call LogThisMessage(userID,"- " & pageName & " rs was set to Nothing")
End Function


The logging in the function is recently added to help us know the problem and it's not deployed on the server yet.
0
 

Author Comment

by:ko78
ID: 10858167
ap_sajith,
We have string concatenations But I don't believe that it's the cause, why?
Because form the IIS logs I find that the pages that have the string concatenations are not called between the up and down times I only find the pages that I am talking about, I find them once up then down. with no any other pages in the middle.
I have revised the code twice and eliminated all the leakage that was there, so I don't think this is the reason as well.

About the threading model, it might be the reason can you tell me more about that? I don't know much about it.

I am not calling a COM object that I have created, but the virtual directory protection level is set to high which in turns create a component for the application. The virtual directory name is et, so there is a COM+ Application created called IIS-{Default Web Site//Root/et} I went in the tree and opened Components then IISWAM.1__Root__et the properties of this com object shows "Free Thread Apartment" under the concurrency tab, could this cause the error?

Thanks

0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10858174
After taking out the LogThisMessage (I assume they just log whats happening) the ON ERROR GOTO 0 jumped out at me, I would say that the ON ERROR RESUME NEXT is making it continue but the GOTO 0 send it back to the start - this might cause your infinate loop.

Maybe get rid of the GOTO
0
 

Author Comment

by:ko78
ID: 10858198
The on error resume next and on error goto 0 was added to turn on and off error handling that might be caused bye the logging function, these statements didn't exist before, and On error goto 0 in VB turns off error handling it doesn't change the execution path like goto statements in other languages

This is from the MSDN:
Use On Error GoTo 0 to disable error handling if you have previously enabled it using On Error Resume Next.

Thanks
0
 
LVL 20

Expert Comment

by:jitganguly
ID: 10862771
My 2 cents, this line

 If rs.State = 1 Then

Where is RS instantiated here ? It has be in this function to check properties againts this.
0
 

Author Comment

by:ko78
ID: 10866977
In call openrs(rs, strSQL)

sub openrs(rs, strSQL)
      set rs = Server.CreateObject("ADODB.Recordset")
      rs.cursorlocation=3
      rs.open strSQL,connectionObject
      set rs.activeconnection = Nothing
end sub
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10869476
Try adding

set rs=nothing
Set connectionObject=nothing

at the bottom of all the pages you are opening a recordset. Then only you will explicitly destroy the objects created. This is because marshalling (Cleanup) in ASP is not the best around.

Cheers!!
0
 

Author Comment

by:ko78
ID: 10869552
I have that already

This is executed in the function

If rs.State = 1 Then
          rs.close
          Call LogThisMessage(userID,"- " & pageName & " rs was Closed")
     end if
     set rs = Nothing
and the connection obect is set to nothing also at the end of the page,

You didn't tell me how to change the threading mode or how can it cause the problem

Thanks
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 21

Expert Comment

by:ap_sajith
ID: 10876120
I had mentioned the threading model incase you are using any Custom DLL's in your app. Go through this article on threading model.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/selectingathreadingmodel.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconapartmentmodelmultithreadinginvisualbasic.asp

Are you using any custom components?. Are they running in page scope?

Cheers!!
0
 

Author Comment

by:ko78
ID: 10876351
Just one component, it's a third party component, not found in the component services, I guess it's registered during the installation by regsvr32.
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10983935
Sorry, Forgot about this Question... Whats the status with this?. Did you manage to solve this?. Do you need any further assistance?.

BTW.. Is there any specific errors listed in the Event Viewer?.

Cheers!!
0
 

Author Comment

by:ko78
ID: 10984739
yes I contacted MS development support center they found out that another application has halted the script engine
We are still in the phase of trrying to reproduce it and fix the problem
Thanks all for your help
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10986392
That is always the problem of not having a dedicated server for each application....

FtB
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 11020940
Kindly close this question...Refer this link for help on how to close a question.

http://www.experts-exchange.com/help.jsp#hs5

Cheers!!
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 11025622
No issues...

Cheers!!
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 11057702
Closed, 500 points refunded.
PashaMod
Community Support Moderator
0
 
LVL 1

Expert Comment

by:ppellegrini
ID: 11602040
I'd be glad to hear if MS Development support was able to provide any solutions and what they were?  I've had a similar problem with my Exchange Outlook Web Access since installing SP4 on my Win2K Server.

Paul
0
 

Author Comment

by:ko78
ID: 11602179
They guided me that another application causes the Script engine to crash. I went to the Middle East Development Support Center. It was free.


Here's the link,
http://www.microsoft.com/middleeast/developers/meadsc/form.asp

You should submit your problem and they will answer you.

Hope your problem is solved soon isA
0
 

Expert Comment

by:pk_sathishkumar
ID: 13222413
hello every body, I'm struck with the same situation. The operating system is Windows2000 running with service pack 4 and my application is ASP running on IIS 5. The web application was running fine for more than a year, but suddenly shows
dllhost.exe shooting to 100% cpu usage .
   I have checked the tips given by the experts like if there were any infinite loops, or session variable carrying conactenate strings,or huge arrays but no such problems were found.

    The dllhost.exe process can be killed.So the temporary solution i have did is setting a batch file to kill the dllhost.exe every 15 minutes thru scheduled task. But the problem is when ever the killing runs the website users get a message rpc service denied for a few sec,but on a refresh the web page turns to be normal

   Since i dont have any micrsoft subscribtion would like to know the workarounds or steps carried out by ko78, as he claims to have solved a similar situation.

    I have been running behind this for more than a week. Expecting a reply at the earliest.

Thanks in advance.

 
 

0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13230430
>> I have been running behind this for more than a week. Expecting a reply at the earliest.<<

Then you might want to consider posting a new question so that it gets attention by everybody rather than just those involved in this thread.

FtB
0
 
LVL 1

Expert Comment

by:ppellegrini
ID: 13230583
Hey  pk_sathishkumar,

I solved a similar problem with Microsoft patch KB818709 - go search it on their site.  Good Luck.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now