Showing posts with label timeout. Show all posts
Showing posts with label timeout. Show all posts

Tuesday, March 27, 2012

Error executing non query: Timeout expired

I was having some errors from the webpage accessing the OLlinks table in the database.

Error executing non query: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at admin_admOLEditLinks.selectData(String strID) in e:\wwwroot\home\admin\admOLEditLinks.aspx.cs:line 101
DateTime:5/23/2007 1:14:10 PM
Source:http://www.myDomain.comiAdmin/admOLEditLinks.aspx?ID=3
ErrorMessage:Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I kept getting the above error so then I try to access the table directly inside of MS SQL Server Management Studio and then I recieved the following error:

SQL Execution Error.

Executed SQL statement: SELECT lnkID, linkFromID, linkToID FROM OLlinks

Error Source: .Net SqlClient Data Provider

Error Message: Timeout expired. The timeout period elapsed prior to completion of the opration or the server is not responding.

Open any other table works fine except this table only. Any help is much appreciated.

Looks like you are returning too many rows to the application? If you run the query in Query Analyzer how many rows does your SELECT statement retrieve?

|||

Okay, here's what I did. In MS SQL Server Management Studio, I click on the New Query icon and pasted in the "SELECT lnkID, linkFromID, linkToID FROM OLlinks" query and the query run fine with only 5 records showing. But if I right click on the OLlinks table in the Tables folder and choose Open Table then I do not see any records showing...and then for a long time I will receive the above error.

This problem does not occur everytime. It happens randomly.

|||

From the description you provided it looks that there is a lock which is there on the table.Might be you are running something in transaction which uses this table. Check in the Activity monitor and see the Lock by process.

|||

I don't think that is the case. I was able to open other tables fine. In addition, this problem only occurs randomly or appears to occur randomly.

And by the way, where is the Activity monitor?

|||

In the sql management studio... under the Management Node... It is.. I was talking about just a possibility and it would be nice to check if it is the case.Big Smile

|||

There is nothing in the Management Node.

|||

Hi,

If it only occurs randomly, I assume that some other operation might be locking the table you're querying.

You can try to increase the timeout value of the command execution. To check if someone else is locking the table, you can use SQL Profiler.

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!

Sunday, February 26, 2012

Error Code if Row is locked

Hallo,
if a row is locked in SQLExpress and an other user want to update this row,
SQLExpress waits until timeout. And than I get the errormessage "timeout".

What I need is an immediately errormessage "row is locked" !

So that the user dont need to wait if the row is locked
and I need the correct errormessage so that I can check
if there is a databaseproblem or only the row locked
because an other user is editing the same rows.

Thx Wolfgang
(please excuse my english)

hi,

SQL Server does not provide this feature as this should be managed on the client side of the application and not server side on SQL Server...

you can thus set an appropriate timeout on the ado/ado.net command you are using, and then take the required decision once the command result in an exception..

but you have to fine tune your timeout, depending on SQL Server load, bandwidth, network trafic, ..

regards

|||

Thank you for your help!

I need a small timeout if the Updatecommand "meets" locked rows.
I do not want to reduce the timeout for the SqlCommand itself.

The solution i have found is to use the keyword NOWAIT in the SQL-Statement.

UPDATE table WITH (NOWAIT) SET ......

I think this works okay, but I have not found something to set timeout for locks to 1 sec
and timeout for SQLCommand to 15 sec.

Thany you for your help.
Wolfgang