UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record
Symptoms
Cases are not created, and in some instances, emails received related to existing cases fail to be processed and the following error is sent to the email address configured in "Route Error Emails to This Email Address":
The attached message was sent to the Email Service address
<e2cpremium@xxxxxxxxxxxxx.apex.salesforce.com>
but could not be processed because the Apex class: E2CP.ProcessMessage failed with the following error:
System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: []
Similar errors are returned when using Email to Case (standard) and other custom Apex Email Services. |
Solutions
Unfortunately this error is the result of a resource contention on the Force.com platform and there is no perfect solution that we can provide. The likelihood of encountering this error increases with the concurrency of emails received and automation that runs for each email received. The following tips might help reduce the occurrences of this issue. We realize that they might be impractical or impossible to implement and wish there was a perfect solution to offer. Email Volume
Automation (Apex Triggers, Workflow Rules, Rollup Summaries)
|
Status
This is a known limitation on the Force.com platform. A number of factors that contribute to this issue making it impossible to predict how many emails can be processed concurrently without error. 2/18/2018 - Although we have not observed any regression, we have no plans to remove "beta" classification due to the nature of this solution and it will remain unsupported. 1/31/2014 - Internet Creations has created a "retry" feature that provides a work around in most instances. |
Additional Information
https://help.salesforce.com/articleView?id=000229525&type=1 https://success.salesforce.com/issues_view?id=a1p30000000T3UYAA0 |