I caught events blocked_process_report and tried to analyze what was blocked and why. The xml data I saw the following information:
<data name="blocked_process">
<value>
<blocked-process-report monitorLoop="797267">
<blocked-process>
<process id="process20758057c28" taskpriority="0" logused="20000" waittime="15874" schedulerid="2" kpid="25520" status="suspended" spid="650" sbid="0" ecid="2" priority="0" trancount="0" lastbatchstarted="2023-05-22T16:43:25.330" lastbatchcompleted="2023-05-22T16:43:25.330" lastattention="1900-01-01T00:00:00.330" clientapp="83 Server" hostname="024" hostpid="39912" isolationlevel="read committed (2)" xactid="454142046462" currentdb="5" currentdbname="XXX" lockTimeout="20000" clientoption1="671230048" clientoption2="128056">
<executionStack>
<frame line="1" stmtstart="950" stmtend="17300" sqlhandle="0x02000000fd5a0839e4850791d608df1f6698c2cd53e6609a0000000000000000000000000000000000000000"/>
<frame line="1" sqlhandle="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"/>
</executionStack>
<inputbuf> (@P1 numeric(10),@P2 numeric(10),@P3 numeric(10),@P4 datetime2(3),@P5 nvarchar(4000),@P6 numeric(10),@P7 datetime2(3),@P8 nvarchar(4000),@P9 numeric(10),@P10 numeric(10),@P11 varbinary(16),@P12 varbinary(16),@P13 nvarchar(4000),@P14 varbinary(16),@P15 varbinary(16),@P16 varbinary(16),@P17 varbinary(16),@P18 varbinary(16),@P19 varbinary(16),@P20 varbinary(16),@P21 varbinary(16),@P22 varbinary(16),@P23 varbinary(16),@P24 varbinary(16),@P25 varbinary(16),@P26 varbinary(16))SELECT DISTINCT ... </inputbuf>
</process>
</blocked-process>
<blocking-process>
<process status="runnable" spid="650" sbid="0" ecid="4" priority="0" trancount="0" lastbatchstarted="2023-05-22T16:43:25.330" lastbatchcompleted="2023-05-22T16:43:25.330" lastattention="1900-01-01T00:00:00.330" clientapp="83 Server" hostname="024" hostpid="39912" isolationlevel="read committed (2)" xactid="454142046462" currentdb="5" currentdbname="XXX" lockTimeout="20000" clientoption1="671230048" clientoption2="128056">
<executionStack>
<frame line="1" stmtstart="950" stmtend="17300" sqlhandle="0x02000000fd5a0839e4850791d608df1f6698c2cd53e6609a0000000000000000000000000000000000000000"/>
<frame line="1" sqlhandle="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"/>
</executionStack>
<inputbuf> (@P1 numeric(10),@P2 numeric(10),@P3 numeric(10),@P4 datetime2(3),@P5 nvarchar(4000),@P6 numeric(10),@P7 datetime2(3),@P8 nvarchar(4000),@P9 numeric(10),@P10 numeric(10),@P11 varbinary(16),@P12 varbinary(16),@P13 nvarchar(4000),@P14 varbinary(16),@P15 varbinary(16),@P16 varbinary(16),@P17 varbinary(16),@P18 varbinary(16),@P19 varbinary(16),@P20 varbinary(16),@P21 varbinary(16),@P22 varbinary(16),@P23 varbinary(16),@P24 varbinary(16),@P25 varbinary(16),@P26 varbinary(16))SELECT DISTINCT ...</inputbuf>
</process>
</blocking-process>
</blocked-process-report>
</value>
</data>
So as there two threads of process the one of them blocked other, because only difference between them is ecid.
How can I proceed
investigation of this issue? I guess that it is some kind of latch but I don't know the best way to understand root cause for blocking