Stale Thread Error - Thread has been recycled
SummaryPega 7.1.7 is built on the Pega Customer Service and Sales Automation (SFA) frameworks.
Database is MSSQL 2012 and WebLogic server 12c.The data pages are loaded asynchronously on the landing page. When navigating to the Details page on clicking the link, the sections do not render correctly and error occurs.
The sections load correctly when the data pages are loaded synchronously on the landing page.
[fault (self-tuning)'] [STANDARD] [ ] [ ] (internal.mgmt.Executable) ERROR Rule-Connect-SOAP.<<XXXX>>-<<MMM>>-Int-FD-StndrdHeader-CBS-StandardHeader-I-.StandardHeader - Exception
[fault (self-tuning)'] [STANDARD] [ ] [ ] (mgmt.base.ThreadData) ERROR - Trying to use a recycled thread
com.pega.pegarules.pub.context.StaleThreadError: Thread has been recycled
Steps to Reproduce
Invoke the data page from the UI section through an activity.
Set up a Top Level data page, D_Parent_DataPage.
This invokes multiple child data pages.
Each child data page invokes its respective activity.
In each activity triggered by a child data page, the D_Parent_DataPage is referred.
Root CauseThe D_Parent_DataPage is loaded asynchronously. That is, the data page is loaded in an asynchronous cache area of the memory. The Load-DataPage method loaded the data page asynchronously and with every reference to the data page, it is referred on the asynchronous cache.
The D_Child_DataPage is loaded asynchronously when it is referred in the section.
The data source of the D_Parent_DataPage is an activity which invoked the Load-DataPage for a different embedded D_Child_DataPage. The data source of the embedded data page populated the D_Parent_DataPage and not itself.
Hence, the D_Parent_DataPage is shared in different threads which are created for each embedded data page. This causes Concurrent Modifications exceptions.
Additionally, the owning thread of the D_Parent_DataPage becomes stale and generates the 'Thread has been recycled' message.
At runtime, since each Load-Datapage call refers to the D_Parent_DataPage, they simultaneously update and refer back to the D_Parent_DataPage parent data page.
In an adhoc manner, there are occurrences where the version referred during a specific data page call is outdated (stale) as another thread had updated the same data page which is shared (currently) in the cache area.
This caused issues because multiple threads accessed the same thread which hosted the D_Parent_DataPage.
ResolutionPerform the following local-change:
- Load data in to embedded data pages.
- When the embedded data page is loaded within its own context, read from the embedded data page and copy to the parent D_Parent_DataPage.
Published April 3, 2019 — Updated April 6, 2019