Hi All,
Today came across a blocking issue from the application. A very simple INSERT ran and the spid is in "sleeping" "AWAITING_COMMAND" with an open transaction and lock on the table. After 15 hours, then comes a spid which "truncate that table" and it is waiting on Sch-M lock. There is no implicit_Tran on. but don't know why it has one open transaction. I seeing this behavior quite often and eventually had to kill that insert spid. isolation is Read- committed and RCSI is on for that particular db.
<additional_info>
<text_size>-1</text_size>
<language>us_english</language>
<date_format>mdy</date_format>
<date_first>7</date_first>
<quoted_identifier>ON</quoted_identifier>
<arithabort>OFF</arithabort>
<ansi_null_dflt_on>ON</ansi_null_dflt_on>
<ansi_defaults>OFF</ansi_defaults>
<ansi_warnings>ON</ansi_warnings>
<ansi_padding>ON</ansi_padding>
<ansi_nulls>ON</ansi_nulls>
<concat_null_yields_null>ON</concat_null_yields_null>
<transaction_isolation_level>ReadCommitted</transaction_isolation_level>
<lock_timeout>-1</lock_timeout>
<deadlock_priority>0</deadlock_priority>
<row_count>1</row_count>
<command_type>AWAITING COMMAND</command_type>
<sql_handle>0x01000b002c203603d0be7be26602000000000000</sql_handle>
<statement_start_offset>-1</statement_start_offset>
<statement_end_offset>-1</statement_end_offset>
<host_process_id>25578</host_process_id>
<group_id>2</group_id>
<original_login_name>app_ors</original_login_name>
</additional_info>
My questions, by default any connection to sql server will be auto-commit mode , (correct me if I am wrong). I have tested this with a small insert on dept table and as and when the insert is done, its auto-commited by default and there is no open_tran. however, it is "sleeping" and "awaiting_command" as expected. I opened a new ssms window and tried to SELECT * FROM DEPT; I was able to see the new record which means the insert has been auto committed.
In case, of the application WHY it is keeping the transaction open in that spid for a simple insert.
Am I missing anything? what else can we collect or check to know the root cause of that open txn? is there a possibility of another spid has open that txn( i dont think so) !! . please give some ideas.
Regards,
Sam