Sample Header Ad - 728x90

Does client timeout send the execution of a stored procedure from the TRY block to the CATCH block?

1 vote
1 answer
170 views
What happens when a client timeout occurs during the execution of a stored procedure that raises XACT_ABORT and wraps its body in TRY/CATCH blocks? I am looking at a bunch of procedures that generally can be converted to an MWE as follows: create or alter procedure ##ptx as begin try set xact_abort on waitfor delay '10:00' end try begin catch declare @xsx int = XACT_STATE() raiserror('XSX=%d', 16, 10, @xsx) with log, nowait end catch I created a test harness that logs into the server as SA, asynchronously calls such procedure, and times out the call after X seconds but earlier than the delay should run out. There are no new entries in the log, so it looks like the execution does not enter the CATCH block when a timeout occurs. Should it? If it should not, then what happens upon the client timeout?
Asked by Betty Liv (43 rep)
Apr 20, 2024, 10:38 PM
Last activity: Apr 21, 2024, 01:31 PM