I’m changing process to multi-thread process. I changed process with class Thread and working ok, now I want to change using Batch Server (class run on a server, CIL). I have a problem with multiple batches at the same time. Problem is a deadlock.
Batch1:
Delete_from Tab1 exists join Tab2 where Tab1.id = Tab2.id and Tab2.Group=’AAA’
Batch2:
Delete_from Tab1 exists join Tab2 where Tab1.id = Tab2.id and Tab2.Group=’BBB’
In this scenario I have a problem (infolog):
Cannot delete a record in @... (Tab1). Deadlock, where one or more users have simultaneously locked the whole table or part of it.
Microsoft.Dynamics.Ax.Xpp.DeadlockException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.DeadlockException' was thrown. at Microsoft.Dynamics.Ax.MSIL.Interop.throwException(Int32 ExceptionValue) at Microsoft.Dynamics.Ax.MSIL.cqlCursorIL.DeleteAll(IntPtr table)
at Dynamics.Ax.Application….() in ….xpp:line …
After changing my methods like below everything is OK:
Batch1:
Select forUpdate Tab1 exists join Tab2 where Tab1.id = Tab2.id and Tab2.Group=’AAA’
{ Tab1.doDelete()}
Batch2:
Select forUpdate Tab1 exists join Tab2 where Tab1.id = Tab2.id and Tab2.Group=’BBB’
{ Tab1.doDelete()}
Why delete_from … is wrong in CIL in BatchServer?
*This post is locked for comments