function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rupali PophaliyaRupali Pophaliya 

Email to Case error: UNABLE_TO_LOCK_ROW : unable to obtain exclusive access to this record

Hi,

We have set up Email to Case functionality. We are getting this error at least once in a day and the case is not opened:

UNABLE_TO_LOCK_ROW : unable to obtain exclusive access to this record

We have gone through this knowledge Article: https://help.salesforce.com/apex/HTViewSolution?urlname=Email-to-Case-error-UNABLE-TO-LOCK-ROW-unable-to-obtain-exclusive-access-to-this-record&language=en_US (https://help.salesforce.com/apex/HTViewSolution?urlname=Email-to-Case-error-UNABLE-TO-LOCK-ROW-unable-to-obtain-exclusive-access-to-this-record&language=en_US)

But, when case is created, we are not updating any parent record of it.

What is the reason of this issue?

Thanks,
Rupali
Vinit_KumarVinit_Kumar
The way I would approach is to set the debug logs and see what's going on there??
Rupali PophaliyaRupali Pophaliya
Thanks Vinit. But, I am not sure when exactly this error is coming. This issue happens once in 10 cases.
Vinit_KumarVinit_Kumar
If you have a premier account,you can log a case with support and ask for the root cause of this issue,they might help you.
Rupali PophaliyaRupali Pophaliya
Our client is facing this issue. They opened a case to Salesforce and salesforce support couldn't help.
Vinit_KumarVinit_Kumar
Not sure what to say Rupali :(
Sandy CartographerSandy Cartographer
Hi Rupali, were you able to find a solution to this? I am facing exactly the same problem. 
Daniel ScharffeDaniel Scharffe
Did anyone find the answer to this issue yet?  We have the same issue.  It seems to be random and only happens once or twice a month.  
mohit chhabramohit chhabra
This Issue is likely to happen if you data skew in the system, where a single Record( let say Account) is associated with multiple child records(more than 10000) which causes record lockout problem.

Now in the email to case scenario  if multiple transactions are happening concurrently and all are trying to create contacts/cases( with same account record on lookup field) then there is always a small probabilty that one transaction holding the lock on particular account record will put the other transaction in record lock out phase( just because of skew).

Generally, salesforce platform processes more than billion transactions per day with average response time of less than 300 milliseconds and database holds a lock for a very short amount of time but due to skew which causes some lock contention and reduce database concurrency.

 
Jonathan Meltzer 14Jonathan Meltzer 14
Okay...but are there any settings that we can use to make SF retry the Email to Case process so that the case can get created?