SqlClient.SqlException .Number = 3617 .State = 68 - sql-server

We are receiving this exception from one of our sql select statements. I cannot find error 3617 in the sysmessages table. The .Class is 25. There is no message.
We know we are getting it on Sql server 2005 servers.
I do know that this is large select that joins several tables and uses the CLR to combine and order some data.
What could be causing this error or where I could find out what the error code means?

Take a look at this: Discussion on Microsoft forums, see the answer from the moderator last in the post.
Updated: (added text from forum post):
Error code 3617 is a system attention. A system attention occurs
when the client cancels a running request. This can happen if the
command times out for example. This error is normally not sent to the
client however.
There is a special case where this can occur that you may be hitting.
When you re-use a pooled connection, the first outbound request sends
a special bit flag on the request to tell the server to reset the
connection state prior to executing the request. This bit causes the
server to first clear connection state, then execute the command. If
your SQL Server is under heavy load, and this bit is set, and it takes
a long time to reset the connection state, the client may timeout and
send the system attention. This causes the reset of the connection to
be cancelled and in this case you can see the 3617 sent to the client.
We've recently hardened this code in current release to avoid sending
back this specific error code as the error is spurious in nature
(based on timing you may or may not get this error). In any case, you
can consider this error equivalent to: "A severe error occurred on the
current command. The results, if any, should be discarded. Operation
cancelled by user."
To verify if it is this issue, examine your SQL errorlog for error
like below:
spid51 Task abort was requested while attempting to reuse a session with SPID 51, which has been reset for connection pooling. The session
will be terminated.

Related

Connecting to Snowflake with DataGrip fequent timeout errors

When working with Snowflake through DataGrip I often get the following timeout error:
JDBC driver encountered communication error. Message: Exception encountered for HTTP request: Operation timed out.
Usually on a second attempt it will be fine, but I always need to wait for this timeout to occur before I can do anything. If I continue to run queries after getting the initial connection it will be fine, but if I was to leave the application for a few minutes, again when I come back it struggles to re-connect for the next query.
My suspicion is that this occurs when the Snowflake warehouse is suspended. It seems like it is waiting on some acknowledgment that the warehouse has been resumed.
Has anyone else encountered this?

NServiceBus Expired Message Purge Fails, Unable to Remove Messages, Logs WARN

We have some NServiceBus Handlers (6.4.0) using SQL Server Transport (3.1.2) that run fine, but their expired message purge cycle always fails to remove any rows, and a WARN is always logged about this. Contrary to the message, I don't see any messages accumulating in the endpoint table. The image below is of the handler running as a console app, logging the WARN.
WARN when running as console app
Environment Oddities: Our transport (and user data) database is in Compatibility Mode 80 (i.e. SQL Server 2000 mode) even though the server instance is 2008 R2. We had some trouble with the transport tables because the the server complained that ARITHABORT had to be on to support the index used on those tables, but our corporate software demands it be off by default. To get around changing it globally, in EndpointConfig we use the 'UseCustomConnectionFactory()' to supply a function which creates new SqlConnections and, after creation, runs SET ARITHABORT ON on the connection before returning it for use by the application. That seemed to solve that issue - but now we get the purge failure and WARN. The actual error message mentions "timeout" and 'server not responding' - but the database is continually available, query-able, and in use when this is occurring. Additionally, this occurs when volume is very low - as low as 2 or 3 messages per minute.
Any ideas on what might be wrong, how we might debug further, or how to resolve the issues, are very much appreciated.

SQL Server Agent - Semaphore timeout

I have a SQL Server Agent Job with one step. The step executes a stored procedure on the local server, and nothing more. When the job executes (either manually or scheduled), I receive the following error. The job fails after about 23 seconds.
Msg 121, Level 20, State 0, Line 0 A transport-level error has
occurred when receiving results from the server. (provider: TCP
Provider, error: 0 - The semaphore timeout period has expired.)
However, I have no problem executing the stored procedure manually. I receive the proper results in less than a second.
The 'semaphore' error tends to be a hardware or network issue. But since the job is executing on the local server, I am unclear how hardware or network latency could be an issue.
UPDATE (things I've tried)
After each of these attempts, I put everything back to its original state. Each of these attempts has the same results (works when I RDP to the server, fails everywhere else).
The underlying stored procedure calls out to a linked-server. I removed these references.
Assuming the problem is some kind of call out to the AD domain-controller, I used a SQL Login instead of a Windows User.
I modified the job to run as me (since I can do everything).
Another note: When executing, the job fails to start. So, it's not even getting to the stored procedure.
I would approach this problem by following below steps...
1.Ensure Query is finetuned
2.Ensure stats and indexes are upto date
Semaphore time outs mostly relate to insufficient memory in the system..So updating stats will help sql server in getting memory estimates right..and this should solve most of timeouts
But since the job is executing on the local server
I assume you meant ,you are running job in same box as of server..not remotely..even in this cases ,we faced time outs(general),but we ruled out hardware and network issues through below steps
TCP Offloading/Chimney & RSS…What is it and should I disable it?
changed Remote Login,Remote query time outs(these may not be applicable to your error message)

Error 17886 - The server will drop the connection

We are running a website on a vps server with sql server 2008 x64 r2. We are being bombarded with 17886 errors - namely:
The server will drop the connection, because the client driver has
sent multiple requests while the session is in single-user mode. This
error occurs when a client sends a request to reset the connection
while there are batches still running in the session, or when the
client sends a request while the session is resetting a connection.
Please contact the client driver vendor.
This causes sql statements to return corrupt results. I have tried pretty much all of the suggestions I have found on the net, including:
with mars, and without.
with pooling and without
with async=true and without
we only have one database and it is absolutely multi-user.
Everything has been installed recently so it is up to date. They may be correlated with high cpu (though not exclusively according to the monitors I have seen). Also correlated with high request rates from search engines. However, high cpu/requests shouldn't cause sql connections to reset - at worst we should have high response times or iis refusing to send response.
Any suggestions? I am only a developer not dba - do i need a dba to solve this problem?
Not sure but some of your queries might cause deadlocks on the server.
At the point you detect this error again
Open Management Studio (on the server, install it if necessary)
Open a new query window
Run sp_who2
Check the blkby column which is short for Blocked By. If there is any data in that column you have a deadlock problem (Normally it should be like the screenshot I attached, completely empty).
If you have a deadlock then we can continue with next steps. But right now please check that.
To fix the error above, ”MultipleActiveResultSets=True” needs to be added to the connection string.
via Event ID 17886 MSSQLServer – The server will drop the connection
I would create an eventlog task to email you whenever 17886 is thrown. Then go immediately to the db and execute the sp_who2, get the blkby spid and run a dbcc inputbuffer. Hopefully the eventinfo will give you something a bit more tangible to go on.
sp_who2
DBCC INPUTBUFFER(62)
GO
Use a "Instance Per Request" strategy in your DI-instantiation code and your problem will be solved
Most probably you are using dependency injection. During web development you have to take into account the possibility of concurrent requests. Therefor you have to make sure every request gets new instances during DI, otherwise you will get into concurrency issues. Don't be cheap by using ".SingleInstance" for services and contexts.
Enabling MARS will probably decrease the number of errors, but the errors that are encountered will be less clear. Enabling MARS is always never the solution, do not use this unless you know what you're doing.

How to find timed out statements in SQL 2005 profiler

I'm trying to find SQL statements that timed out using the SQL 2005 profiler. Is there a way to set such a filter?
In Profiler, you can add the event "Attention" under "Errors and Warnings". It's definition is
Collects all attention events, such as
client interrupt request or when a
client connection is broken.
As far as other errors (deadlocks, contraints, etc), try "Execution Warning" (reports warning that occurred during the execution of SQL statement or procedure) or "User Error Message" (the error message displayed to the user in the case of an error or exception).
Yes.
Check "All Events"
Go to the lock section
Specify the "lock: Timeout" events
Lock event in Books Online
Now, this works with server side locks (##LOCK_TIMEOUT <> 0).
I don't know if a client side timeout will be trapped.
One option, if you know what your client configured timeouts are set to (ie. 30 seconds by default), you can set a filter on your trace to only collect events with a duration greater than or equal to your timeout (minus a second or two).

Resources