locked
Error - Transaction was deadlocked in plugin for CRM 2011 RRS feed

  • Question

  • hello, 

    i have one workflow which updates the entity status.  on update of status have one plugin which performs the delete operations.

    when workflow  gets called for multiple records , plugin is failing in delete operation with below error -

    Transaction (Process ID 143) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

    can anyone please help me on this?

    Thanks


    Pooja


    Monday, August 24, 2015 5:54 AM

All replies

  • run in query: 

    DBcc traceon(1222,-1)   
     DBcc traceon(1204,-1)

    check error log..


    Please click "Mark As Answer" if my post helped.

    Monday, August 24, 2015 8:44 AM
  • I expect the deadlocks are due to the sequence of data modification operations. There are 2 general approaches that can reduce the likelihood of deadlocks:

    1. Ensure all operations within the plugin are executed using the IOrganizationService instance that you derive from the context. This will keep all operations on the same SQL process
    2. Set one or more of the plugins (in this case, I'd suggest the plugin on the status update) to run asynchronously

    There are 2 other options:


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Monday, August 24, 2015 3:38 PM
    Moderator
  • hi David, 

    thanks for your reply . i tried your options . option 1 is already in place . option 2 of async plugin - its still showing  deadlock. even replaces plugin with  custom workflow  activity b ut issue is still there. customer cant upgrade to newer versions of CRM now. 

    deadlock is occurring when Queue Item delete is called from plugin instances.

    do you have any other option ?

    thanks!


    Pooja

    Friday, August 28, 2015 7:35 AM