strong textWe are using "Rebex.FileTransfer" library Version="5.0.7290" in our product. We have encountered a deadlock in production due to this library.
Could you please confirm following;
- Is there a possibility of Deadloack in Rebex generated threads running stack cited below?
- Since we did not see this deadlock during 2 years of usage; so we would like to know what special conditions may have caused this deadlock now.
- What is your suggestion of mitigating this issue? Also please let us know if this issue is fixed in version later than 5.0.7290.
Please let us know if you need more info.
Observations from memory dump.
0:006> !dlk
Examining SyncBlocks...
Scanning for ReaderWriterLock(Slim) instances...
Scanning for holders of ReaderWriterLock locks...
Scanning for holders of ReaderWriterLockSlim locks...
Examining CriticalSections...
Scanning for threads waiting on SyncBlocks...
Scanning for threads waiting on ReaderWriterLock locks...
Scanning for threads waiting on ReaderWriterLocksSlim locks...
Scanning for threads waiting on CriticalSections...
DEADLOCK DETECTED
CLR thread 0x3c holds the lock on SyncBlock 000001d2d5ec69f0 OBJ:000001d2bc7a67c0[System.Object]
...and is waiting for the lock on SyncBlock 000001d2d5ff2c78 OBJ:000001d2bc7a67f0[System.Object]
CLR thread 0x50 holds the lock on SyncBlock 000001d2d5ff2c78 OBJ:000001d2bc7a67f0[System.Object]
...and is waiting for the lock on SyncBlock 000001d2d5ec69f0 OBJ:000001d2bc7a67c0[System.Object]
CLR Thread 0x3c is waiting at Rebex.Net.SshChannel.bksd(jnrr)(+0x17 IL,+0x42 Native)
CLR Thread 0x50 is waiting at Rebex.Net.SshChannel.bkry()(+0x17 IL,+0x40 Native)
1 deadlock detected.
The threads involved in deadlocks are thread 11 & 13 they are running following call stack.
0:013> !syncblk
Index SyncBlock MonitorHeld Recursion Owning Thread Info SyncBlock Owner
361 000001d2d5ec69f0 3 1 000001d2d60adc60 958 11 000001d2bc7a67c0 System.Object
362 000001d2d5ff2c78 3 1 000001d2d629e110 2c54 13 000001d2bc7a67f0 System.Object
364 000001d2d5ec6788 1 1 000001d2d629e110 2c54 13 000001d2bc7a21a0 System.Collections.Generic.List`1[[System.Threading.ManualResetEvent, System.Private.CoreLib]]
Total 427
CCW 1
RCW 1
ComClassFactory 0
Free 377
0:011> !clrstack
OS Thread Id: 0x958 (11)
Child SP IP Call Site
000000f076bfe898 00007ff985f667c4 [GCFrame: 000000f076bfe898]
000000f076bfea38 00007ff985f667c4 [GCFrame: 000000f076bfea38]
000000f076bfea88 00007ff985f667c4 [HelperMethodFrame1OBJ: 000000f076bfea88] System.Threading.Monitor.ReliableEnter(System.Object, Boolean ByRef)
000000f076bfebe0 00007ff9078c2b32 Rebex.Net.SshChannel.bksd(jnrr)
000000f076bfec40 00007ff9078c4991 Rebex.Net.SshChannel.bkso(Byte[], Int32, Int32)
000000f076bfecd0 00007ff9078c46cb Rebex.Net.SshChannel.Send(Byte[], Int32, Int32)
000000f076bfed10 00007ff9078c445e gldk.iier(jnrr, glcu)
000000f076bfed90 00007ff9078c429c gldk.iidq(Rebex.Net.SftpServerType, glcu)
000000f076bfee10 00007ff9078c071d Rebex.Net.Sftp.qjjf(glcu)
000000f076bfee70 00007ff9078bc0d3 Rebex.Net.Sftp.qjjd(System.String, System.String, Rebex.Net.SshPrivateKey, glcu)
000000f076bfeef0 00007ff9078bbcb4 Rebex.Net.Sftp.Login(System.String, System.String)
000000f076bfef30 00007ff9078bbb63 Rebex.Net.FileTransferClient.Login(System.String, System.String)
000000f076bfef70 00007ff9076fbd64 Airwatch.PushRelayServer.RebexImpl.PushRelayServerConnectionRebexImpl.Connect(Int32)
000000f076bfefd0 00007ff9076fb871 AirWatch.PullService.Business.PushRelayServerBusiness+cDisplayClass261.b0()
000000f076bff020 00007ff949b2d409 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [E:\A_work\694\s\src\mscorlib\shared\System\Threading\ExecutionContext.cs @ 167]
000000f076bff0a0 00007ff949be13e7 System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef) [E:\A_work\694\s\src\mscorlib\src\System\Threading\Tasks\Task.cs @ 2440]
000000f076bff140 00007ff949c1a9ec System.Threading.ThreadPoolWorkQueue.Dispatch() [E:\A_work\694\s\src\mscorlib\src\System\Threading\ThreadPool.cs @ 588]
000000f076bff5c0 00007ff966a93053 [DebuggerU2MCatchHandlerFrame: 000000f076bff5c0]
0:011> ~13s
ntdll!NtWaitForMultipleObjects+0x14:
00007ff9`85f667c4 c3 ret
0:013> !clrstack
OS Thread Id: 0x2c54 (13)
Child SP IP Call Site
000000f08d9fe428 00007ff985f667c4 [GCFrame: 000000f08d9fe428]
000000f08d9fe5c8 00007ff985f667c4 [GCFrame: 000000f08d9fe5c8]
000000f08d9fe618 00007ff985f667c4 [HelperMethodFrame1OBJ: 000000f08d9fe618] System.Threading.Monitor.ReliableEnter(System.Object, Boolean ByRef)
000000f08d9fe770 00007ff9078fe1d0 Rebex.Net.SshChannel.bkry()
000000f08d9fe7d0 00007ff9078c1c87 Rebex.Net.SshChannel.bkrt(Byte[], Int32, Int32)
000000f08d9fe860 00007ff90772ac30 Rebex.Net.SshSession.exvy(Byte[], Int32, Int32)
000000f08d9fe920 00007ff907725f0f Rebex.Net.SshSession.exvx()
000000f08d9fea10 00007ff907726914 Rebex.Net.SshSession.xaxv.exwv()
000000f08d9fea80 00007ff90772658b xaxw+ndag.bnom()
000000f08d9feab0 00007ff907726335 xaxw+ndag.bnon()
000000f08d9feaf0 00007ff96f627080 System.Threading.Thread.ThreadMainThreadStart() [E:\A_work\180\s\corefx\src\System.Threading.Thread\src\System\Threading\Thread.cs @ 93]
000000f08d9feb20 00007ff949b2d409 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [E:\A_work\694\s\src\mscorlib\shared\System\Threading\ExecutionContext.cs @ 167]
000000f08d9fed78 00007ff966a93053 [GCFrame: 000000f08d9fed78]
000000f08d9ff000 00007ff966a93053 [DebuggerU2MCatchHandlerFrame: 000000f08d9ff000]