According to Salesforce's documentation a transaction can wait for up to 10 seconds before throwing an exception with the code "UNABLE_TO_LOCK_ROW". Yet I get the following scenario:
- Transaction A begins on object "CustomObject__c" and locks the Master "Contact" record (The execution time is > 5 seconds).
- Transaction B begins on object "CustomObject__c" few milliseconds after transaction A began and waits ~3 seconds for the lock on the same master "Contact" record to be released before throwing a DmlExecutionException with the code "UNABLE_TO_LOCK_ROW".
Why does Transaction B wait for so little time instead of the documented 10 seconds?
Note 1: There was no execution of any operation in the ORG for few minutes before Transaction A.
Note 2: The scenario is executed in a Sandbox.
Edit: Following the previous comments, I confirm that no process was running on the background (Confirmed by a SOQL on AsyncApexJob object.