Unix Technical Forum

SQL Timeout Errors - Can Anyone Help?

This is a discussion on SQL Timeout Errors - Can Anyone Help? within the SQL Server forums, part of the Microsoft SQL Server category; --> I have a client who has been receiving hundreds of SQL timeout error messages in their error logs. Specifically, ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:42 PM
alvinstraight38@hotmail.com
 
Posts: n/a
Default SQL Timeout Errors - Can Anyone Help?

I have a client who has been receiving hundreds of SQL timeout error
messages in their error logs. Specifically, the message looks like
this:



MESSAGE : 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(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)

at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()


The message just tells me that the update processed failed because SQL
timed out. Yet other updates are getting through. I spent today
deleting old records in her database tables thinking maybe the
database had grown so large that it was taking too look to search the
records, but it did not fix the problem. Any suggestions on how I can
troubleshoot this problem futher?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:42 PM
Erland Sommarskog
 
Posts: n/a
Default Re: SQL Timeout Errors - Can Anyone Help?

alvinstraight38@hotmail.com (alvinstraight38@hotmail.com) writes:
> I have a client who has been receiving hundreds of SQL timeout error
> messages in their error logs. Specifically, the message looks like
> this:
>
> MESSAGE : 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(Com mandBehavior
> cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
>
> at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
>
>
> The message just tells me that the update processed failed because SQL
> timed out. Yet other updates are getting through. I spent today
> deleting old records in her database tables thinking maybe the
> database had grown so large that it was taking too look to search the
> records, but it did not fix the problem. Any suggestions on how I can
> troubleshoot this problem futher?


SQL Server does not time out. It's the client that gets bored of waiting
for SQL Server to return a result set. Most client APIs have a default
timeout of 30 seconds. These timeout can cause a great mess if they
are not handled properly. All SQL Server knows is that the client says
"stop executing", so SQL Server stops executing. But no transaction is
rollback, and if the client does not issue a rollback, locks will continue
to pile up, and you get further blocking and timeout.

There are two possible reasons why a query takes more than 30 seconds
to run: 1) it is a slow query. 2) there is a blocking situation. In the
first case, an easy fix is to change the application and set the command
timeout to 0 (= wait forever) to permit SQL Server more time. Provided of
course, that the longer execution time is acceptable. In a blocking
situation, it depends on what the blocker is up to. If it is an idle
process that failed to commit or rollback a transaction, changing the
timeout is not going to help.

As for troubleshooting, you need of course find which queries that are
timing out. You also need to investigate whether there is blocking;
use sp_who2 for that. If the query is running slow in itself, and you
think it should run faster, you need to analyse the query and the
execution plan to see if the query can be tweaked, or if you need an
index.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:01 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com