Unable to connect to SQL Server session database

Discussion in 'ASP .Net' started by jamezw, Jun 16, 2005.

  1. jamezw

    jamezw Guest

    Hello

    I work on a website where we have 3 servers running one site so we use
    the SQLServer option for state management. We are using the persistent
    ASPState database. All 3 of our webservers are Win2K3 and up-to-date.
    Our SQL Server is up-to-date as well. We have been getting weird
    site-hanging issues lately which seem to be related to the state
    management. Whenever the site starts hanging we will receive an
    application error with a stacktrace like such:

    System.Web.HttpException: Unable to connect to SQL Server session
    database. ---> System.Data.SqlClient.SqlException: Timeout expired.
    The timeout period elapsed prior to completion of the operation or the
    server is not responding.
    at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
    cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
    at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
    at
    System.Web.SessionState.SqlStateClientManager.ReleaseExclusiveAsyncWorker(String
    id, Int32 lockCookie)
    --- End of inner exception stack trace ---
    at
    System.Web.SessionState.SqlStateClientManager.ReleaseExclusiveAsyncWorker(String
    id, Int32 lockCookie)
    at
    System.Web.SessionState.SqlStateClientManager.System.Web.SessionState.IStateClientManager.ReleaseExclusive(String
    id, Int32 lockCookie)
    at System.Web.SessionState.SessionStateModule.OnReleaseState(Object
    source, EventArgs eventArgs)
    at System.Web.SessionState.SessionStateModule.OnEndRequest(Object
    source, EventArgs eventArgs)
    at
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    Boolean& completedSynchronously)

    When these errors occur, they occur on all three webservers at the same
    time, and the same error will re-occur almost exactly 10 minutes later.
    We don't have any jobs running on the SQL server or the web servers
    that occur every 10 minutes, so we have ruled that out. To fix this
    problem, usually we recycle the aspnet processes, but sometimes this
    does not work and we have to stop/start SQL Server. In the worst case
    scenario, we end up rebooting our SQL Server to "fix" the problem. This
    is a really problematic issue for us because it seems to happen during
    high traffic times. Has anyone else experienced something similar to
    this or know of an MS fix?

    Thanks,
    James
     
    jamezw, Jun 16, 2005
    #1
    1. Advertising

  2. Did you set your SqlCommand timeout? That defaults to 30 seconds.
    Please try to set CommandTimeout to 180 or longer time:
    YourCommand.CommandTimeout = 180

    "jamezw" wrote:

    > Hello
    >
    > I work on a website where we have 3 servers running one site so we use
    > the SQLServer option for state management. We are using the persistent
    > ASPState database. All 3 of our webservers are Win2K3 and up-to-date.
    > Our SQL Server is up-to-date as well. We have been getting weird
    > site-hanging issues lately which seem to be related to the state
    > management. Whenever the site starts hanging we will receive an
    > application error with a stacktrace like such:
    >
    > System.Web.HttpException: Unable to connect to SQL Server session
    > database. ---> System.Data.SqlClient.SqlException: Timeout expired.
    > The timeout period elapsed prior to completion of the operation or the
    > server is not responding.
    > at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
    > cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
    > at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
    > at
    > System.Web.SessionState.SqlStateClientManager.ReleaseExclusiveAsyncWorker(String
    > id, Int32 lockCookie)
    > --- End of inner exception stack trace ---
    > at
    > System.Web.SessionState.SqlStateClientManager.ReleaseExclusiveAsyncWorker(String
    > id, Int32 lockCookie)
    > at
    > System.Web.SessionState.SqlStateClientManager.System.Web.SessionState.IStateClientManager.ReleaseExclusive(String
    > id, Int32 lockCookie)
    > at System.Web.SessionState.SessionStateModule.OnReleaseState(Object
    > source, EventArgs eventArgs)
    > at System.Web.SessionState.SessionStateModule.OnEndRequest(Object
    > source, EventArgs eventArgs)
    > at
    > System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
    > at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    > Boolean& completedSynchronously)
    >
    > When these errors occur, they occur on all three webservers at the same
    > time, and the same error will re-occur almost exactly 10 minutes later.
    > We don't have any jobs running on the SQL server or the web servers
    > that occur every 10 minutes, so we have ruled that out. To fix this
    > problem, usually we recycle the aspnet processes, but sometimes this
    > does not work and we have to stop/start SQL Server. In the worst case
    > scenario, we end up rebooting our SQL Server to "fix" the problem. This
    > is a really problematic issue for us because it seems to happen during
    > high traffic times. Has anyone else experienced something similar to
    > this or know of an MS fix?
    >
    > Thanks,
    > James
    >
    >
     
    =?Utf-8?B?Y3Vpa2U1MTk=?=, Jun 17, 2005
    #2
    1. Advertising

  3. jamezw

    jamezw Guest

    It's not as simple as that. The problem is with .NET's session
    management through SQL server.
     
    jamezw, Jun 17, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2FpbGlu?=

    Unable to connect to the Sql server database

    =?Utf-8?B?Q2FpbGlu?=, Sep 9, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,703
    Patrick.O.Ige
    Sep 12, 2005
  2. Peter Afonin
    Replies:
    2
    Views:
    785
    Peter Afonin
    Oct 8, 2006
  3. James

    Unable to connect to SQL Server database

    James, Oct 4, 2006, in forum: ASP .Net Security
    Replies:
    3
    Views:
    567
    James
    Oct 6, 2006
  4. ZZ_Scarab
    Replies:
    2
    Views:
    2,511
    ravish
    Jan 5, 2011
  5. James
    Replies:
    2
    Views:
    475
    James
    Oct 4, 2006
Loading...

Share This Page