connection timeout error while checking mediastream available or not - connection-timeout

In My Console application. i am checking media links which is available in my database through openstream.but one error is raising again and again in diffrent diffrent point.that is "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated"

These 2 similar problems/solutions might give you some ideas.
One was fragmented table and the other was a lock by another db operation.
http://forums.asp.net/t/1513085.aspx/1/10
SQL Server simple Insert statement times out

Related

Why does NHibernate session.Query<T>().Delete() timeout?

I discovered that since NHibernate 5.0 I can call the following code to delete all records of a table:
session.Query<T>().Delete();
It executes the code on the database without copying it across the network, which should improve performance a lot.
But this query times out.
I get the following error:
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I've tried setting the Connection Timeout setting in my connectionstring to 0 and to 3600, but it makes no difference.
My table only has about 200 records. But one column is a base64 encoded pdf, so it is quite big and the query would take a few seconds.
What else can I try?
It sounds like you need to increase the command timeout.
Note that there is a difference between connection timeout and command timeout.
You can set the default command timeout (in seconds) for ADO.NET commands created by NHibernate using the command_timeout NHibernate session configuration property. There are multiple ways to do that depending on what method you use to configure NHibernate. Here are the basics: http://nhibernate.info/doc/nhibernate-reference/session-configuration.html

Max out Azure SQL DTU with SQL inside code, but not from SQL Server Management Studio

I have a bit a funny situation. Our Azure SQL instance maxes out at 100 DTU for a certain query and the query returns a timeout:
SqlException (0x80131904): Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding. This failure occurred while attempting to connect to the
routing destination.
If I run exactly the same query (with the parameters hardcoded) in SQL Server Management Studio it still takes the DTU up to 25%, but that's still far away from 100%. Nothing else runs on that server. There are a few other queries that run before/after. But if we just run them, nothing spikes out.
Any ideas?
My analysis of the issue goes like this..
First when DTU's are maxed out and if a query fails due to that,you will not get time out..Below is the error message you will get..
Resource ID: %d. The %s limit for the database is %d and has been reached. For more information
You can try testing that by opening multiple resource intensive queries
Secondly when you get time out's as indicated in your question,this is mostly due to query waiting for resources like say some database IO,memory..
we faced similar time out's ,but most of them are fixed by updating stats and rebuilding indexes,rest of them we optimized

SSRS - Renamed TempDB and now Subscription Reports not Emailing

I'm currently unable to email out time based subscription reports from SSRS on a new SQL Server 2012 installation on Server 2012.
I receive the following error in the SSRS LogFiles
schedule!WindowsService_5!dc4!10/14/2013-10:01:09:: i INFO: Handling Event TimedSubscription with data 1a762da1-75ab-4c46-b989-471185553304.
library!WindowsService_5!dc4!10/14/2013-10:01:09:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: , An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database.;
library!WindowsService_5!dc4!10/14/2013-10:01:09:: w WARN: Transaction rollback was not executed connection is invalid
schedule!WindowsService_5!dc4!10/14/2013-10:01:09:: i INFO: Error processing event 'TimedSubscription', data = 1a762da1-75ab-4c46-b989-471185553304, error = Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. ---> System.Data.SqlClient.SqlException: Invalid object name 'ReportServerTempDB.dbo.ExecutionCache'.
Databases were migrated from SQL 2008, this was done by a third party and I'm unsure if something was overlooked.
Any assistance would be greatly appreciated.
Thank you.
Dane
This thread seems to address your issue.
http://www.sqlservercentral.com/Forums/Topic553765-147-1.aspx
Please do a modicum of research before posting error messages.
From the Link
"
After much consternation, I have found a trigger referencing the invalid object. Trigger [Schedule_UpdateExpiration] on ReportServer table Schedule has the offending reference in it. In test, I altered this trigger to reference the correct report server tempdb and now subscriptions appear to be working properly. So far I have found nothing else broken."
AND
"If anyone is looking for a quick answer then here is what I did to solve my problem:
Updated trigger on dbo.schedule to reference the correct tempdb.
Scripted all stored procedures with their permissions onto a new query then "find and replaced" all instances of the old tempdb with the new one. "
After a while searching for a solution to fix this issue, I found that this is caused by the jobs definition of SQL Server Agent was not fully migrated to the new service. For every subscription created in SSRS, there is an associated job defined in SQL Server Agent. For services reply heavily on report delivery via subscriptions, it's best to export those jobs definition and import them into the new server.
Daniel E. answer is Correct.
I have spend a lot of time to find it and the error I am getting while updating the existing subscriptions
“An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. (rsReportServerDatabaseError)”
when i search online with the above error, i couldn't manage to fix it. after a long time i found the tigger is pointing to old database.
Temp database in the below: [ReportServerTempDB]
after updating to correct tempDB all started working fine.
ALTER TRIGGER [dbo].[Schedule_UpdateExpiration] ON [dbo].[Schedule]
AFTER UPDATE
AS
UPDATE
EC
SET
AbsoluteExpiration = I.NextRunTime
FROM
[ReportServerTempDB].dbo.ExecutionCache AS EC
INNER JOIN ReportSchedule AS RS ON EC.ReportID = RS.ReportID
INNER JOIN inserted AS I ON RS.ScheduleID = I.ScheduleID AND RS.ReportAction = 3

ADO.net connection timedout before the connection timeout value

We have a WCF Data Service connecting to a SQL Server 2008 R2 database. When the service is trying to access data from the database the connection is getting timed out before the Connection Timeout value and the timeout exception is thrown.
This is the connection string:
Data Source=XXXX;Initial Catalog=XXXX;MultipleActiveResultSets=False;
Connection Timeout=80;Integrated Security=false;User ID=XXX;Password=XXX
In this connection string, even though we gave 80sec as the Connection Timeout, the connection gets timed out at around 700ms and throws below exception
System.Data.SqlClient.SqlException (0x80131904): Timeout
expired.
The timeout period elapsed prior to completion of the
operation or the server is not responding.
This is happening on some queries only.
Any help is appreciated.
It's not the ConnectionTimeout that causes the error; it's the CommandTimeout. See also this question.
Therefore, the solution is to set a higher value for CommandTimeout in case of more expensive queries.
This type of timeout can have three causes;
There's a deadlock somewhere
The database's statistics and/or query plan cache are incorrect
The query is too complex and needs to be tuned
Taken from the following links
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated
try to optimise the query as mentioned here
I had the same problem and google brought me here.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
In my case, the mssql firewall port (default = 1433 TCP) was not yet open on the db server.

Suspended status in SQL Activity Monitor

What would cause a query being done in Management Studio to get suspended?
I perform a simple select top 60000 from a table (which has 11 million rows) and the results come back within a sec or two.
I change the query to top 70000 and the results take up to 40 min.
From doing a bit of searching on another but related issue I came across someone using DBCC FREEPROCCACHE to fix it.
I run DBCC FREEPROCCACHE and then redo the query for 70000 and it seemmed to work.
However, the issue still occurs with a different query.
I increase to say 90000 or if I try to open the table using [Right->Open Table], it pulls about 8000 records and stops.
Checking the activity log for when I do the Open Table shows the session has been suspended with a wait type of "Async_Network_IO". For the session running the select of 90000 the status is "Sleeping", this is the same status for the above select 70000 query which did return but in 45min. It is strange to me that the status shows "Sleeping" and it does not appear to be changing to "Runable" (I have the activiy monitor refreshing ever 30sec).
Additional notes:
I am not running both the Open Table and select 90000 at the same time. All queries are done one at a time.
I am running 32bit SQL Server 2005 SP2 CU9. I tried upgrading to SP3 but ran into install failurs. The issues was occuring prior to me trying this upgrade.
Server setup is an Active/Active cluster the issue occurs on either node, and the other instance does not have this issue.
I have ~20 other database on this same server instance but only this one DB is seeing the issue.
This database gets fairly large. It is currently at 76756.19MB. Data file is 11,513MB.
I am logged in locally on the Server box using Remote Desktop.
The wait type "Async_Network_IO" means that its waiting for the client to retrieve the result set as SQL Server's network buffer is full. Why your client isn't picking up the data in a timely manner I can't say.
The other case it can happen is with linked servers when SQL Server is querying a remote table, in this case SQL Server is waiting for the remote server to respond.
Something worth looking at is virus scanners, if they are monitoring network connections sometimes they can get lagged, its often apparent by them hogging all the CPU.
Suspended means it is waiting on a resource and will resume when it gets its resource. Judging from the sizes you are pulling back, it seems you are in an OLAP type of query.
Try the following things:
Use NOLOCK or set the TRANSACTION ISOLATION LEVEL at the top of the query
Check your execution plan and tune the query to be more efficient