SQL Server Agent - Semaphore timeout - sql-server

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)

Related

SQL Server Agent Job stops SSIS Step with "unexpected error" and without any error informations

I am dealing with my problem on some Windows Server 2019 (Core) with one running SQL Server 2019 CU4 instance each.
What we try to do
We are currently building a data warehouse with distributed databases. The individual layers of the DWH are located on one database server each. The data exchange between the layers/servers takes place via SSIS ETLs, which use Linked Servers to reach the other layers and drag and drop data. Each layer also has its own SSIS service instance and executes the corresponding SSIS packets.
The SSIS packages are called by SQL Server Agent jobs. We have a job that executes the SSIS packets (#1), which in turn calls another job (#2) as the last step, which after a short wait time executes the calling job (#1). Thus, controlled by schedules, a loop is created and data is continuously transferred with ETLs.
I hope this was not too much unnecessary background
The error
Basically the job is running and there are numerous successful executions. However, we are observing interruptions at job #1 without helpful information regarding the error. This means that the job history log refers to the SSIS log, which again only contains an "unexpected termination". In the SSIS log, we only see behavior that indicates that the ETL packet active at that time stopped after validation. Depending on the log level, nothing is logged at all, not even the execution of single packages of the project. The package where this error occurs is different and not limited to a specific one.
What I have already tried
Re-create the jobs and SSIS Enviroments by hand (scripted before)
Using the 32Bit Runtime
Upgrade the SSIS project/package version to
2019
Increase the log level to "verbose"
Patching the SQL Server to CU4
Save ssis dump files (couldn't find them or they weren't created)
Search Windows and SQL Server Logfiles
Does anyone have some suggestions or some ideas how to become more error specific informations?
Thank you very much and take care :)
UPDATE We have an error message (OLE DB 0xC0202009 and 0X80004005)!
In order to exclude the use of environments as a cause, I manually set the parameters in the SSIS job step instead of overwriting them by selecting an environment.
Long story short: Today it turns out that the parameter for an OLE DB Connection String is not passed correctly.
The following is specified as a parameter in the job step:
However, the following connection string is specified in the context of the error message:
Please note that some arguments are added twice to the parameter (red).
What could have caused that?

Logic App - When connecting to on prem sql server: The gateway did not receive a response from 'Microsoft.Web' within the specified time period

I have a sql server database which has around 15 stored procedures and 4,73,000 tables. Every month the number of tables gets increased by around 500.
I have created a logic app and added a sql server action to execute a stored procedure which is available in this database. But when I am trying to see if the logic app is pointed to correct stored procedure from the designer view it is giving me the below exception. Also see the below screen shot.
The gateway did not receive a response from 'Microsoft.Web' within the specified time period.
When I verified the logs of on prem data gateway, the below exception is logged there.
Microsoft.Data.Mashup.MashupHostingException (0x80004005): Timeout expired. The timeout period elapsed prior to completion of the operation.
I tried to increase the RAM of the VM to 16GB still having the same issue.
Can anyone help me out is fixing the issue. I am unable to find the cause of the issue as well.
Thanks in advance.

Another ODBC Call Failed Topic

I am running Access 2010 FE and SQL Server 2005 BE.
I can execute pass through queries to my SQL Server succesfully by using DSNless connections.
During my testing phase sometimes I need to restore my database to get back to my original records so I can rerun my pass through queries. What I have found is when I run a pass through query, it creates an active connection on my SQL Server. I see the connection via the SQL Server Management Console under the MANAGEMENT | SQL Server Logs | Activity Monitor, select view processes. There I can see which process ID is being used and who is using it when I run my pass through query.
Now the only way for me to restore my database is to KILL the PROCESS e.g. Active connection
Now when I have my restored database in place and re-run the pass through query, I receive a ODBC -- Call Failed message box. I have attempted to run a procedure to refresh my querydefs but to no avail, I will still get the ODBC-- Call Failed message box when I click on those objects.
Now there are two options on how to fix this problem, which in either case I find not USER Friendly.
Restart my Access Application
Wait approx 5-10 minutes to rerun the Pass Through Query
I created a function to trap my ODBC Errors and this is what appears:
ODBC Error Number: 0
Error Description: [Microsoft][ODBC SQL Server Driver]Communication link failure
ODBC Error Number: 3146
Error Description: ODBC--call failed.
So if for some reason, I need to restart my SQL server or kill a process (Active Connection) on my SQL server while the Access Application is currently connected via ODBC, the objects created via ODBC will not perform properly till I execute the 2 workaround solutions as stated above.
Can anyone shed some advice on a solution? I appreciate any insight.
I asked a similar question some time ago, and never got a satisfactory answer. My original question is here: Force SET IDENTITY_INSERT to take effect faster from MS Access
There is a registry setting documented here for ACE that controls the timeout behavior:
ConnectionTimeout: The number of seconds a cached connection can remain idle before timing out. The default is 600 (values are of type REG_DWORD).
So as a third workaround (in addition to the two you already listed) you can change that registry setting to a shorter timeout (like 10 seconds). This is the approach I took in my answer. One caveat is that shortening the timeout may cause performance or other issues. Your mileage may vary.
See my full answer to the original question for more info.

SqlClient.SqlException .Number = 3617 .State = 68

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.

SQL Strange Timeout Issue

Ok, so I am trying to create a procedure that call an extended procedure. I am getting the following error:
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.)
Even with the simplest test I get that error:
CREATE PROCEDURE Test
AS
BEGIN
EXEC xp_cmdshell 'dir *.exe'
END
However if I just run xp_cmdshell 'dir *.exe' by itself it works.
This is running on a clustered SQL 2005 server. Any help is appreciated.
Are you getting the error when you CREATE the procedure or when you EXECUTE it?
If you get it when you execute it, then there could be some issue with permissions. Since in later versions of sql server calling xp_cmdshell is tightly locked down and by default not enabled in the surface area configuration, I could see a potential for this.
How are you calling the SP? If you're using dynamic SQL, then know that it executes with the privileges of the caller, not the SP creator.
Do you need to prefix the SP with master as in master.dbo.xp_cmdshell?
Have you tried EXECUTE AS either in the SP creation or in the SP execution?
Also, in my experience, transport-level errors are sometimes not due to a problem with the server but a problem with the client caching its connection object past the time when the server has dropped it (thus invalidating the connection object). Given that you're presumably running this within just a short time of initially connecting, it doesn't sound like that is the exact problem, but could you be having some kind of proxy/firewall/net filter issue that is dropping packets because of detecting certain keywords in the packets? I know this is a long shot but I had to ask...

Resources