Problem: Stored Procedures not completing from Web Application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike J

    Problem: Stored Procedures not completing from Web Application

    I have several stored procedures that run fine from my SQL Server
    database (via the exec command.), though when I call these procedures
    from my web application, they do not complete. I have other
    procedures that in fact do run fine through my web application though,
    so I do not believe its a front-end problem. The procedures only take
    about 30 seconds to run from the back-end, so I know its not a time
    out issue as well. Does anyone have any ideas?

    Thanks in advance.
  • Simon Hayes

    #2
    Re: Problem: Stored Procedures not completing from Web Application


    "Mike J" <mjewett_2000@y ahoo.com> wrote in message
    news:1a9d60fa.0 404261152.322ed 838@posting.goo gle.com...[color=blue]
    > I have several stored procedures that run fine from my SQL Server
    > database (via the exec command.), though when I call these procedures
    > from my web application, they do not complete. I have other
    > procedures that in fact do run fine through my web application though,
    > so I do not believe its a front-end problem. The procedures only take
    > about 30 seconds to run from the back-end, so I know its not a time
    > out issue as well. Does anyone have any ideas?
    >
    > Thanks in advance.[/color]

    Can you clarify what you mean by "does not complete"? Do you get an error
    message? What version of MSSQL? What's the web platform, eg. ASP, PHP etc.?
    If it works fine from Query Analyzer then that suggests an issue on the web
    side, but without more information it's hard to say.

    Simon


    Comment

    • Erland Sommarskog

      #3
      Re: Problem: Stored Procedures not completing from Web Application

      Mike J (mjewett_2000@y ahoo.com) writes:[color=blue]
      > I have several stored procedures that run fine from my SQL Server
      > database (via the exec command.), though when I call these procedures
      > from my web application, they do not complete. I have other
      > procedures that in fact do run fine through my web application though,
      > so I do not believe its a front-end problem. The procedures only take
      > about 30 seconds to run from the back-end, so I know its not a time
      > out issue as well. Does anyone have any ideas?[/color]

      30 seconds is the default time-out, so timeout problems cannot be ruled
      out completely. Do you have proper error handling in your web app?

      There are a couple of possible reasons for this, but since you provided
      very little information about your code, I can only give some general
      comments.

      Do you use indexed views or indexes on computed columns? In such case,
      you need to issue SET ARITHABORT ON when you connect from your web app
      (or make this default for the database with ALTER DATABASE). This setting
      is on by default when you run from Query Analyzer.

      Even if you don't use indexed views or indexed computed columns, SET
      ARITHABORT ON, can still be useful, as you now will get the same plan
      as Query Analyzer does.


      --
      Erland Sommarskog, SQL Server MVP, sommar@algonet. se

      Books Online for SQL Server SP3 at
      Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.

      Comment

      • Mike J

        #4
        Re: Problem: Stored Procedures not completing from Web Application

        "Simon Hayes" <sql@hayes.ch > wrote in message news:<408d7223$ 1_3@news.bluewi n.ch>...[color=blue]
        > "Mike J" <mjewett_2000@y ahoo.com> wrote in message
        > news:1a9d60fa.0 404261152.322ed 838@posting.goo gle.com...[color=green]
        > > I have several stored procedures that run fine from my SQL Server
        > > database (via the exec command.), though when I call these procedures
        > > from my web application, they do not complete. I have other
        > > procedures that in fact do run fine through my web application though,
        > > so I do not believe its a front-end problem. The procedures only take
        > > about 30 seconds to run from the back-end, so I know its not a time
        > > out issue as well. Does anyone have any ideas?
        > >
        > > Thanks in advance.[/color]
        >
        > Can you clarify what you mean by "does not complete"? Do you get an error
        > message? What version of MSSQL? What's the web platform, eg. ASP, PHP etc.?
        > If it works fine from Query Analyzer then that suggests an issue on the web
        > side, but without more information it's hard to say.
        >
        > Simon[/color]

        Simon,

        Here's some more elaboration. By "does not complete" I mean that the
        procedures simply never finish running. They generate no error
        messages, and do not lock any objects -- they just dont finish. I
        verify this by manually running the procedures in query analyzer
        (where they finish quickly) and viewing the results. The strange
        thing is that we use over 50 stored procedures, and almost all of them
        work -- from both the web application and query analyzer. The couple
        procedures that are "not finishing" are not any more complex than the
        others.

        The web platform we are using is Microsoft asp .NET. We are using SQL
        Server 2000 as well.
        Any ideas? Thanks.

        Comment

        • Mike J

          #5
          Re: Problem: Stored Procedures not completing from Web Application

          Erland Sommarskog <sommar@algonet .se> wrote in message news:<Xns94D7EF 10D40A3Yazorman @127.0.0.1>...[color=blue]
          > Mike J (mjewett_2000@y ahoo.com) writes:[color=green]
          > > I have several stored procedures that run fine from my SQL Server
          > > database (via the exec command.), though when I call these procedures
          > > from my web application, they do not complete. I have other
          > > procedures that in fact do run fine through my web application though,
          > > so I do not believe its a front-end problem. The procedures only take
          > > about 30 seconds to run from the back-end, so I know its not a time
          > > out issue as well. Does anyone have any ideas?[/color]
          >
          > 30 seconds is the default time-out, so timeout problems cannot be ruled
          > out completely. Do you have proper error handling in your web app?
          >
          > There are a couple of possible reasons for this, but since you provided
          > very little information about your code, I can only give some general
          > comments.
          >
          > Do you use indexed views or indexes on computed columns? In such case,
          > you need to issue SET ARITHABORT ON when you connect from your web app
          > (or make this default for the database with ALTER DATABASE). This setting
          > is on by default when you run from Query Analyzer.
          >
          > Even if you don't use indexed views or indexed computed columns, SET
          > ARITHABORT ON, can still be useful, as you now will get the same plan
          > as Query Analyzer does.[/color]


          Erland, yes, we have proper error handling in our web application. We
          in fact run many (around 50) stored procedures from our web
          application and they complete just fine. The couple procedures that
          do not run from the application are not any more complex than the
          others.

          To elaborate some more on our system, we are using Microsoft .NET, SQL
          Server 2000. I have run many tests in query analyzer on our database
          server with the procedures in question. They complete accurately and
          quickly every time, with no errors. Its only when I call them from
          the web app where do not finish. We do not use any indexed views or
          computed columns, though I will try to ARITHABOR ON property anyhow.
          Any other ideas?
          Thanks.

          Comment

          • Erland Sommarskog

            #6
            Re: Problem: Stored Procedures not completing from Web Application

            Mike J (mjewett_2000@y ahoo.com) writes:[color=blue]
            > To elaborate some more on our system, we are using Microsoft .NET, SQL
            > Server 2000. I have run many tests in query analyzer on our database
            > server with the procedures in question. They complete accurately and
            > quickly every time, with no errors. Its only when I call them from
            > the web app where do not finish. We do not use any indexed views or
            > computed columns, though I will try to ARITHABOR ON property anyhow.
            > Any other ideas?[/color]

            With that miniscule of information, no. Well, while you ruled out blocking
            in another posting, one possibility is that you manage to block yourself
            in the app. When you have a procedure which does not complete, execute
            sp_who, and see if any process has a non-zero value in the Blk column.

            If there is no blocking, use the Profiler to see where the process gets
            stuck.

            --
            Erland Sommarskog, SQL Server MVP, sommar@algonet. se

            Books Online for SQL Server SP3 at
            Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.

            Comment

            • DaveGerard
              New Member
              • Jun 2006
              • 2

              #7
              Stored Procedure Timeout in Web Application

              I had experienced issues with a store proc executing very quickly in Query Analyzer, but not from my ASP app against a development database. I noticed recently the same issue with the procedure not executing quickly in either QA or the web app.

              After checking my table indexes on the dev database I found one joined table that had no index for the fields I was joining on. The index existed in the production database. Once adding that index. the procedure executed in < 1 second in QA and only a couple seconds from the web app.

              Hope this helps anyone who's frustrated with similar issues.

              Dave

              Comment

              Working...