web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Generic SQL Errors - Deadlocks

(0) ShareShare
ReportReport
Posted on by 1,720

Hi

We have been getting Generic SQL Errors on our on-premise installation of Dynamics CRM 2013. The errors are thrown when reports are running or data being imported through a utility (a C# windows application that reads data from a csv file and populates multiple entities). When there is no reports or imports running then the system works OK. Through SQL profiler and trace I have found the actual error to be deadlocks being created. These deadlocks could be on any table but mostly I have noticed that ActivityPointerBase table is involved specially when imports are running (we create a lot of tasks during import).

Can anyone please tell me how to get rid of these errors.

Edit: In most of the cases, the SQL statement causing deadlock is 

update [ActivityPointerBase] set [PostAuthorAccountYomiName]=@PostAuthorAccountYomiName0 where ([PostAuthorAccount] = @PostAuthorAccount0 and [PostAuthorAccountType] = @PostAuthorAccountType0)

Can anyone please tell me why this update is taking place?

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    purwar purwar Profile Picture
    2,836 on at

    There is any plugin or workflow on create of activity. if yes pls disable and check it.

  • Mir Hassan Ali Profile Picture
    1,720 on at

    Thanks, there is a PostCreate plugin but that contains whole business logic, disabling it is not an option.

  • Suggested answer
    purwar purwar Profile Picture
    2,836 on at

    Ok , You just disable it  and import only some record for testing perpose , to identify cause of deadlock.

    If it is related to plugin check  deapth of plugin excution.

  • Mir Hassan Ali Profile Picture
    1,720 on at

    This only seems to happen on the production environment not on the UAT so I can't import test records on LIVE environment. But I could see that the tables involved in deadlock are accessed through the plugin.

    Thanks

  • Mir Hassan Ali Profile Picture
    1,720 on at

    In the plugin I have been using fetch XML for querying different entities. If I use the no-lock attribute within fetch XML, will it be beneficial?

    Thanks

  • Royal King Profile Picture
    27,686 on at

    take look its below post that provides how troubleshoot the deadlock issue and adding indexing seems to be fixed the issue

    www.celedonpartners.com/.../resolving-microsoft-dynamics-crm-asynchronous-deadlocks

  • Suggested answer
    purwar purwar Profile Picture
    2,836 on at

    You could try:

    1-If this is caused by code in a synchronous plugin, make sure that you use the IOrganizationService instance that you can derive from the plugin context, rather than creating a new OrganizationServiceClient instance - this will ensure all changes are within the same transaction, rather than separate transactions.

    2-Useful indexes to find the activity pointer records should exist, so the only thing you can do re indexes is check that you haven't removed any from the activitypointerbase table.

    3-If you're running Crm 2011, upgrade to Crm 2013. Some changes to Crm 2013 significantly reduce the likelihood of deadlocks, though admittedly I don't think they affect this query.

    4-If the same query is used for the winner and the victim, and you've checked my first suggestion, then it implies you may have concurrent actions updating the primary attribute of multiple records - can you design your code / processes to make these happen in sequence ?

    You can also check below link:

    mscrmmindfire.wordpress.com/.../avoiding-deadlock-in-plugins

    rokhri.com/.../crm-2011-api-avoid-deadlocks-in-plugins

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans