I have a WSDL Apex service that consumes XML and creates a series of objects.
XML received and parsed, queries for and finds a single account "Potential Customer" to relate potential customer contacts too. (I am aware this is a horrible practice in general, not to mention at scale, but not the topic of this question).
Looks for contact with customer name, does not find it. Initiates create sequence relating up to the "Potential Customer" account.
DML_BEGINkicks off contact creation and triggers.
CODE_UNIT_STARTEDfor before insert trigger kicks off for contact,
DML_ENDfor Contact insert, next line is DmlException UNABLE_TO_LOCK_ROW.
If the user hitting the WSDL service sends two of these requests within the 14 second lock period for two customers, ex: John Smith and Bob Miller where they both relate up to the same Potential Customer account record, could this cause the
UNABLE_TO_LOCK_ROW error since they relate up to the same account? Does locking of rows cascade down like that?
I know if a related record, such as tasks are being inserted, a lock is placed on the account, but do not know if this happens in reverse.
OR... perhaps the lock row error is not on the contact, but on the account, and I am erroneously believing it's on the contact because it happens after the contact before insert trigger completes?
10:25:23.504 (5504947775)|DML_END| 10:25:23.504 (6505152170)|EXCEPTION_THROWN||System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: 
Related SF docs: