Apex script unhandled exception by user/organization: 005100000005555/00D10000000DDDD
Visualforce ページ: /apex/VisualforcePageName
caused by: System.DmlException: Update failed. First exception on row 0 with id a011000000xxxxXXXX; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: []
Class.VisualforcePageNameController.method: line 108, column 1
このメッセージは、UNABLE_TO_LOCK_ROW エラーが発生している事を示しています。
また、こちらのメッセージからは以下の事が読み取れます。
エラーが発生した組織の組織ID:00D10000000DDDD
エラーが発生した処理を実行したユーザ:https://<instance>.salesforce.com/005100000005555
エラーが発生したレコード:https://<instance>.salesforce.com/a011000000xxxxXXXX
エラーが発生したVisualforceページ:VisualforcePageName
エラーが発生したApex Controller:VisualforcePageNameController
エラーが発生したメソッド:method
UNABLE_TO_LOCK_ROW エラーは、更新処理 A が更新処理を実行しようとした対象レコードが別の更新処理 B から更新処理を実行中であり、データの整合性を保つ為にロックされているために更新処理 A がロックの解放を待機する状態となり、待機時間の上限値を超過して待機してしまった際に発生するエラーとなります。
発生する要因は複数あり、以下の状況などが考えられます。
特にオブジェクト構造上見落とされがちな発生状況としては、主従関係を持つ主オブジェクト A、従オブジェクト B が存在し従オブジェクト B のレコードを更新した際に、主従関係を持つ主オブジェクト A のレコードがロックされるという動作に影響を受け発生する事例が挙げられます。
多数の処理が同じ主オブジェクトのレコードを持つ従オブジェクトレコードを更新すると 1 つの主オブジェクトのレコードに多重でロック処理が実行されます。
後続の更新処理は、ロックの開放を待機しますが、多重の処理が同時実行されている状況下では後続の処理程ロックの待機時間が伸び、上限値を超過する可能性が高くなります。
対象のエラーが発生しているオブジェクトについて、上記の主従関係に無いかどうか確認してください。
また、上記のような状況下にある場合には、コードの変更等で回避する方法が無いため、1 つの主オブジェクトに結び付く多数の従オブジェクトに対して、同時に処理が実行されないようレコードの状況を変更頂く等、オペレーションでの対応が必要となります。
000385705

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.