Concurrency error when using WSAPI

Document ID : KB000077114
Last Modified Date : 11/04/2018
Show Technical Document Details
When writing integrations that perform numerous simultaneous transactions or many transactions in a rapid succession, a transaction may fail with a concurrency exception.  The error returned may appear as follows:
{"CreateResult": {"_rallyAPIMajor": "1", "_rallyAPIMinor": "43", "Errors": ["Concurrency conflict: [Object has been modified since being read for update in this context] - ConcurrencyConflictException : Modified since read on update : Object Class : com.f4tech.slm.domain.Subscription : ObjectID : 100000001"], "Warnings": [ ]}}
This is not an issue with the newly created or modified object being updated, but rather the revision history table in the Agile Central database.  Editing two different objects at the same time could cause this, as could revising the subscription while editing a user for example.  A subscription admin is able to view the revision history by going into the Setup screen, clicking Subscription and then clicking the Revisions link.
This issue is frequently seen in multi-threaded applications where the external application is sending too many update requests at the same time. This can be mitigated by having the app work in a single-threaded mode thereby sending requests one at a time with a slight delay, however this will not prevent the error in all situations.  The best solution is to trap/detect the error and retry the update request again.