Process fails intermittently

Document ID : KB000103089
Last Modified Date : 22/06/2018
Show Technical Document Details
Introduction:


 
Question:
The process fails only sometimes and it is not consistent in the behavior. When the process step that has erroed out when selected and retried it error is rectified without making any changes to the process. What is causing this intermittent issue?

BG-CA log shows exception: 


<XOGOutput xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/status.xsd"> 
<Object type="project"/> 
<Status elapsedTime="0.285 seconds" state="FAILURE"/> 
<Statistics failureRecords="1" insertedRecords="0" totalNumberOfRecords="1" updatedRecords="0"/> 
<Records> 
<Record> 
<KeyInformation> 
<column name="ID">5009348</column> 
<column name="name">R-00235767 On Semiconductor Co</column> 
<column name="UNIQUE_NAME">129996</column> 
</KeyInformation> 
<ErrorInformation> 
<Severity>FATAL</Severity> 
<Description>Project Object update failed</Description> 
<Exception><![CDATA[ 
java.lang.Exception: 31 
at 


APP-CA log shows error:

WARN 2018-06-11 13:03:57,731 [http-nio-14001-exec-4] niku.xql2 (clarity:admin:12321440__75C0B6B8-7859-4270-BD78-692C266B1F88:XOG::project::write) Lock prImportExport held by user 1 requested by user 1 
WARN 2018-06-11 13:03:57,731 [http-nio-14001-exec-4] niku.schedulers (clarity:admin:12321440__75C0B6B8-7859-4270-BD78-692C266B1F88:XOG::project::write) ImportProjectProcessor.doProcess(): Project (ID=5009348) is locked by another user! 
ERROR 2018-06-11 13:03:57,732 [http-nio-14001-exec-4] niku.xql2 (clarity:admin:12321440__75C0B6B8-7859-4270-BD78-692C266B1F88:XOG::project::write) Failure while evaluating "xogprojectapi($PROCESS,$OT_PROJECT,srcRecord.delete)" in expression " 
{xogprojectapi($PROCESS,$OT_PROJECT,srcRecord.delete)} 

java.lang.Exception: Invalid expression xogprojectapi($PROCESS,$OT_PROJECT,srcRecord.delete): 31 
at 

Caused by: java.lang.Exception: 31 
at com.niku.schedulers.api.XOGProjectAPI.returnErrorMessage(XOGProjectAPI.java:472) 
at 
Answer:
You have multiple XOG requests in multiple threads fighting for updates on the same project at the same time. 
You need to revise your use of performing immediate project updates via XOG so that contention doesn’t occur. 
You need to query the prlock table before you do project updates via XOG to avoid the contention. 
Projects get locked during XOG update, so ANY process can lock a Project. Usually it is brief and doesn't cause a problem, but if you have a lot of processes running on the same process instance, this might occasionally happen. 

You can run the following query to check if there was a lock on the project or not before you do project updates via XOG to avoid the contention: 

Select * From PRLOCK where PRRECORDID= the project's internal ID. 

Note: 
util:sleep should never be used, it creates a computational bottleneck. 
You have to introduce some delay/retry mechanism and that has to avoid using <util:sleep>. if you need to ‘pause’ something, do it outside of your GEL script.