Bug 780003 (SOA-2363)

Summary: TransactionReaper may execute continuously
Product: [JBoss] JBoss Enterprise SOA Platform 5 Reporter: Kevin Conner <kevin.conner>
Component: EAPAssignee: Julian Coleman <jcoleman>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.1.0.ER1CC: jbertram
Target Milestone: ---   
Target Release: 5.1.0 GA, 5.1.0.ER3   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-2363
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-11 03:32:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 780040    

Description Kevin Conner 2010-09-30 11:48:40 UTC
project_key: SOA

JBossTS TransactionReaper contains a bug which results in the reaper executing continuously within dynamic mode, rather than pausing between runs.

The ReaperThread calls the TransactionReaper.checkingPeriod() method to determine how long it should pause before it can invoke the TransactionReaper.check() method, however there exists a circumstance where the checkingPeriod() will return a negative period for a sustained time, resulting in the thread executing continuously.  This occurs when the check() method is invoked while there are existing transactions in the ReaperElementManager.

The check and checkingPeriod methods use the nextDynamicCheckTime variable to store the absolute time at which the next invocation of check should occur, checkingPeriod returns the difference between that time and the current.

When the check method is executed after nextDynamicCheckTime has occurred, the method retrieves the first ReaperElement from the ReaperElementManager.  The processing continues as follows
- if no reaperElement present, reset nextDynamicCheckTime to Long.MAX_VALUE
- if present and expired (reaperElement.getAbsoluteTimeout() <= now) then the element is processed
- if present and not expired (reaperElement.getAbsoluteTimeout() > now) then do nothing.

It is the last behaviour which is incorrect as the nextDynamicCheckTime still refers to the previous absolute timeout, i.e. < now, resulting in all calls to checkinPeriod() returning a negative value.

This will only be halted if one of the other conditions is true, i.e. the ReaperElementManager is empty or the head element must be processed by this thread.

Comment 1 Kevin Conner 2010-09-30 11:49:50 UTC
Suggested fix.

--- ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java	(revision 35354)
+++ ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java	(working copy)
@@ -192,7 +192,9 @@
                     nextDynamicCheckTime.set(Long.MAX_VALUE);
                     return;
                 } else {
-                    if(reaperElement.getAbsoluteTimeout() > now) {
+                    final long nextTimeout = reaperElement.getAbsoluteTimeout() ;
+                    if(nextTimeout > now) {
+                        nextDynamicCheckTime.set(nextTimeout);
                         return; // nothing to do yet.
                     }
                 }


Comment 2 Kevin Conner 2010-09-30 12:17:44 UTC
Link: Added: This issue depends JBPAPP-5175


Comment 3 Pavel Macik 2010-10-11 12:52:25 UTC
Link: Added: This issue is a dependency of SOA-2402


Comment 4 Julian Coleman 2010-10-12 14:57:43 UTC
Resolved with revision 6955 of:

  build-tools/builders/eap/post-patch/patch_jbossts.xml        (new)

Committ message:
  SOA-2263
  Overwrite jbossjts.jar with JBoss TS 4.6.1.CP08 from JBPAPP-5193.
  Change implVersion in jar-versions.xml.


Comment 5 Julian Coleman 2010-10-15 15:21:38 UTC
JBPAPP-5193 contains builds of the fixed TS code (4.6.1.CP08).

Comment 6 Julian Coleman 2010-10-15 15:21:38 UTC
Link: Added: This issue is related to JBPAPP-5193


Comment 8 Dana Mison 2011-01-05 00:14:38 UTC
Writer: Added: dlesage


Comment 9 David Le Sage 2011-02-11 03:29:15 UTC
Temporarily reopening to update release note info.

Comment 10 David Le Sage 2011-02-11 03:31:55 UTC
Release Notes Docs Status: Added: Documented as Resolved Issue
Release Notes Text: Added: https://issues.jboss.org/browse/JBPAPP-5175

The JBossTS TransactionReaper contained a bug which caused it to execute continuously when it was running in dynamic mode, rather than pausing between runs. This caused  performance degradation. To fix this issue, JBossTS was updated.  As a result, the Reaper now pauses between runs, leading to better performance.


Comment 11 Justin Bertram 2011-02-18 03:11:12 UTC
FYI - I had to re-open JBPAPP-5193.  Please see my last comment there for details.