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
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?

1 Answer 1


When the client aborts execution, it does so by sending an Attention signal to SQL Server.

Aborting execution this way rolls back the current statement and ends execution completely.

The only thing XACT_ABORT affects is whether any open transaction is rolled back or not.

You cannot catch or handle an attention signal in T-SQL.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.