Skip to content

Commit

Permalink
[WFTC-52] calling XATerminator when subordinate transaction is removed
Browse files Browse the repository at this point in the history
when subordinate transaction is removed from the 'known' ones,
we need to announce Narayana to clean its space too, otherwise
there is memory leak happening
  • Loading branch information
ochaloup authored and dmlloyd committed Jun 8, 2018
1 parent 149d6b1 commit e840d92
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public interface Log extends BasicLogger {
@Message(value = "Unknown I/O error when listing xa resource recovery files in %s (File.list() returned null)")
void listXAResourceRecoveryFilesNull(File dir);

@LogMessage(level = Logger.Level.WARN)
@Message(value = "Error while removing imported transaction of xid %s from the underlying transaction manager")
void cannotRemoveImportedTransaction(Xid xid, @Cause XAException e);

// Debug

Expand Down Expand Up @@ -112,6 +115,10 @@ public interface Log extends BasicLogger {
@Message(value = "Recovered in doubt xa resource (%s) from xa resource recovery registry %s")
void xaResourceRecoveredFromRecoveryRegistry(URI uri, Path filePath);

@LogMessage(level = Logger.Level.TRACE)
@Message(value = "Unknown xid %s to be removed from the instances known to the wfly txn client")
void unknownXidToBeRemovedFromTheKnownTransactionInstances(Xid xid);

// Regular messages

@Message(id = 0, value = "No transaction associated with the current thread")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,22 @@ public void afterCompletion(final int status) {
final ConcurrentMap<SimpleXid, Entry> known = JBossLocalTransactionProvider.this.known;
final Iterator<XidKey> iterator = timeoutSet.headSet(new XidKey(SimpleXid.EMPTY, timeTick)).iterator();
while (iterator.hasNext()) {
known.remove(iterator.next().getId());
SimpleXid xidToRemove = iterator.next().getId();
Entry knownEntry = known.remove(xidToRemove);

if (knownEntry == null) {
Log.log.unknownXidToBeRemovedFromTheKnownTransactionInstances(xidToRemove);
} else {
final Transaction transaction = knownEntry.getTransaction();
if (transaction instanceof ImportedTransaction) {
try {
ext.removeImportedTransaction(getXid(transaction));
} catch (XAException xae) {
Log.log.cannotRemoveImportedTransaction(xidToRemove, xae);
}
}
}

iterator.remove();
}
}
Expand Down

0 comments on commit e840d92

Please # to comment.