An asp page caused cpu rising to 100% --> dllhost.exe

Discussion in 'ASP General' started by c676228, Feb 2, 2007.

  1. c676228

    c676228 Guest

    Hi all,
    Today, an interesting thing happened to me. When I am doing the test of an
    asp program, one of the pages(which I submitted several ten times before, no
    problem at all) caused our server cpu rising to 100% and I reset IIS and
    submit that page again and same thing happened again, and then reset IIS
    again and it happened again, the process caused this is dllhost.exe.
    Thinking about what's the difference this time from what I submitted before.
    The only thing I can think of is I entered some name fields data with
    apostrophe.

    I am wondering what is the issue?
     
    c676228, Feb 2, 2007
    #1
    1. Advertisements

  2. c676228

    Mike Brind Guest

    Why do you think the apostrophe is relevant?
     
    Mike Brind, Feb 2, 2007
    #2
    1. Advertisements

  3. c676228

    c676228 Guest

    Hi Mike,
    I don't think it is relevant. I just cannot figure out why the page cause
    the problem today. Out site has this kind of issue very often. I am haunted
    by the problem these days.
     
    c676228, Feb 2, 2007
    #3
  4. Hello Betty,

    It seems that an ASP page used to work well currently raise high CPU
    problem on your production environment,correct?

    Based on my experience, for classic ASP, high CPU issue is mostly caused by
    the Page that call some COM components and run into some issue with the COM
    object's function call. Elsewise, the page's code logic is also worth
    checking since you mentioned that you've changed the input data of the
    page, you can change the page back to the original input data to see
    whether the problem remains.

    I'm not sure whether you've some other ASP or IIS applications host on that
    site and shared the same worker process with your classic ASP application.
    If so, you can consider set your problem ASP application's IIS virtual
    directory's "application Protection" level to high(for IIS 5) or make it
    use a separate application pool from other applications(for IIS6). Thus,
    your ASP application will own a IIS worker process itself and won't be
    affected by other applications.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Feb 5, 2007
    #4
  5. c676228

    c676228 Guest

    Hi Steven,
    I believe you probably can give me a hint. I am pretty sure that my code has
    some problems when the name fieldd have some apostrophe. And I duplicate the
    problem case again, but I cannot figure out what is the problem. Here is the
    code.


    Function PrepCustomerDatatoArray(iTotNumCustomer)
    dim CustInfoArr(50, 5)
    ....
    for i=1 to iTotNumCustomer

    If InStr(FName, "'") <> 0 Then
    CustInfoArr(i-1, 0)=EscStrApostrophe(FName) ' B'etty will become B''etty
    Else
    CustInfoArr(i-1, 0)=FName
    End If
    Response.Write CustInfoArr(i-1, 0) & "<br>" ' It can display B''etty in the
    next page
    If MInit<> "" Then
    CustInfoArr(i-1, 1)=MInit
    End If
    If InStr(LName, "'") <> 0 Then
    CustInfoArr(i-1, 2)=EscStrApostrophe(LName)
    Else
    CustInfoArr(i-1, 2)=LName
    End If
    Response.Write CustInfoArr(i-1, 2) & "<br>" ' It can displayed O''neal if
    customer enter O'neal as last name in the next page
    CustInfoArr(i-1, 3)=BDate

    Next
    'but here it what the problem occurs I believe
    'if iTotNumInsured =1, the fname and lname in array with apostrophe will
    become empty here
    'but it display MInit and BirthDate OK
    'if fields don't have apostrophe, it will be displayed fine
    'if iTotNumInsured >1, the server cpu becomes 100%,
    'what is going on the array is in the scope since mInit and bDate are fine
    and if
    'no apostrophe, everything is fine?
    For i=1 to iTotNumInsured
    Response.Write CustInfoArr(i-1, 0) & " " & CustInfoArr(i-1, 1) & " " &
    CustInfoArr(i-1, 2) & " " & CustInfoArr(i-1, 3)
    Next
    End Function

    Function EscStrApostrophe(ByVal Str)
    dim NameArr
    dim NameStr
    NameStr=""
    NameArr=Split(Str, "'", -1)
    For i=0 to UBound(NameArr)
    NameStr=NameStr & NameArr(i) & "''"
    Next
    EscStrApostrophe=Left(NameStr, Len(NameStr)-2)
    End Function
     
    c676228, Feb 5, 2007
    #5
  6. Ummm, it appears that you are not aware there is a builtin vbscript
    function called Replace that does exactly what your function is doing,
    correct? You should use it in your function:

    Function EscStrApostrophe(ByVal Str)
    If len(Sr) > 0 then
    EscStrApostrophe=Replace(Str,"'","''")
    Else
    EscStrApostrophe=Str
    End If
    End Function
     
    Bob Barrows [MVP], Feb 5, 2007
    #6
  7. c676228

    c676228 Guest

    Hi Bob,
    Thanks for showing me that, I know the replace function but I don't know why
    I created that similar funciton myself, funny. It's the problem from that
    function for sure, after I replace the function with your code, it's
    perfectly fine. it won't cause cpu problem or not responding issue any more.
    but I still don't know what's wrong with my original code. I need to figure
    out any way in order to avoid similar problem in my code.

    Thank you so much. :=))
     
    c676228, Feb 5, 2007
    #7
  8. Thanks for Bob's good idea,

    That does save a lot of code and time :)

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Feb 6, 2007
    #8
  9. c676228

    c676228 Guest

    Steven,
    You made good point too. I use IIS 5.0, if set up too many applications to
    "High" application, I believe I probably will use more memory, but I guess
    it will help to nail down the culprit application.
     
    c676228, Feb 6, 2007
    #9
  10. I suspect your code was ending-up in a forever loop. If you turn errors
    off, and an error occurs in the evaluation of a boolean expression, such as:

    On Error Resume Next
    For i = 1 to UBound(NameArr)
    [...]
    Next

    If an error occurs testing that expression, like say NameArr is not an
    array, control flows to the next statement; effectively the code runs as if
    the condition were true.


    -Mark
     
    Mark J. McGinty, Feb 6, 2007
    #10
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.