2

I have a web application that throws the following error for every user almost every day at the same time of day. You can set your watch by it. Is there a configuration setting or something I am missing that could be causing this problem?

Message: Unable to connect to SQL Server session database. Stack Trace: at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e) at System.Web.SessionState.SqlSessionStateStore.SqlExecuteReaderWithRetry(SqlCommand cmd, CommandBehavior cmdBehavior) at System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) at System.Web.SessionState.SqlSessionStateStore.GetItem(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) at System.Web.SessionState.SessionStateModule.GetSessionStateItem() at System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state)

Mike T.
  • 345
  • 3
  • 8
  • 1
    Just guessing: Application pool recycling and application not yet properly initialized (ineffective warm up)? – Sani Huttunen Jul 10 '18 at 17:49
  • I checked the Application Pool settings in IIS and they don't seem to be the cause. What do you mean by ineffective warm up? – Mike T. Jul 10 '18 at 17:51
  • 1
    The default recycle time is 1740 minutes if not changed or disabled. ASP.NET Warm Up, I.e: https://stackoverflow.com/questions/13250679/how-to-warm-up-entity-framework-when-does-it-get-cold But since we know nothing more of your application then it's hard to say exactly what is wrong. – Sani Huttunen Jul 10 '18 at 17:55
  • What's happening on the SQL Server at that time? Is this a reporting database that gets restored nightly? Therefore, would be offline during the restore (single user mode). Does this exception resolve itself quickly or does it remain for x minutes? – S3S Jul 10 '18 at 18:40
  • The database is just a session database for a .net application. The exception resolves itself after roughly 2-5 minutes. The kicker is it happens every 24 hours. – Mike T. Jul 10 '18 at 18:47
  • 1
    definitely sounds like application pool recycling, but that is 29 hours not 24 so the time would change daily. – S3S Jul 10 '18 at 18:51
  • That's my initial thought as well but in IIS it's definitely not set for 24 hours. – Mike T. Jul 10 '18 at 18:53
  • 1
    Monitor the connection between the IIS machine and the SQL Server machine around the specific time. If you can find network interrupts or SQL Server downtime, then it can be explained. Involving DBA and network guys in your team/company would be required, as the exception indicates a connection failure. – Lex Li Jul 10 '18 at 19:30
  • I've found a scheduled maintenance task on the DB server that runs at the exact time of our problems. I'm betting that isn't a coincidence. Thanks for all the suggestions. – Mike T. Jul 10 '18 at 20:25

0 Answers0