Support Article
Agent picking up same item repeatedly
SA-68641
Summary
The application is configured with a standard agent that is used to process child work objects. The queue items are generated with a Max Attempts value of 10. The user noticed that the queue item is being re-queued even though the child work object was processed successfully.
Error Messages
Cannot obtain a lock on instance ORG-APP-WORK <ID>, as Requestor <RequestorID> already has the lock
Steps to Reproduce
- Create a parent case and three child items for this case.
- Configure a standard agent to process the child cases.
- Queue three child cases to the agent where the agent activity will initiate a flow until the child item is processed to completion.
Root Cause
An issue in the custom application code or rules where a lock error in the activity caused the queue item to be re-queued and processed again
Resolution
The queue item shows the pyMaxAttempts set to 10 and the pyMinimumAgeForProcessing set to 500 milliseconds. To ensure the queue item does not get picked up again until the next agent run, you need to make sure that the pyMinimumAgeForProcessing value is longer than the interval for the agent.
The following article describes this scenario:
https://community.pega.com/support/support-articles/all-attempts-execute-within-same-agent-run
Logic can also be added to the activity where the lock error occurred to check the status. If you still want to continue processing even though that step failed, use the Activity-Clear-Status method to clear the error.
Published December 19, 2018 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.