You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by es...@apache.org on 2016/07/08 22:28:28 UTC
incubator-geode git commit: GOEDE-1621: Do not throw
IllegalArgumentException in TXState cleanup() code if expected or before
offheap resources are released.
Repository: incubator-geode
Updated Branches:
refs/heads/develop f8a899ca9 -> 8c71023b7
GOEDE-1621: Do not throw IllegalArgumentException in TXState cleanup()
code if expected or before offheap resources are released.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/8c71023b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/8c71023b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/8c71023b
Branch: refs/heads/develop
Commit: 8c71023b7cafb68e94b2a6355848f51e41d54b6b
Parents: f8a899c
Author: eshu <es...@pivotal.io>
Authored: Fri Jul 8 15:21:09 2016 -0700
Committer: eshu <es...@pivotal.io>
Committed: Fri Jul 8 15:28:14 2016 -0700
----------------------------------------------------------------------
.../gemstone/gemfire/internal/cache/TXLockRequest.java | 6 ++----
.../java/com/gemstone/gemfire/internal/cache/TXState.java | 10 +++++++++-
.../gemfire/internal/cache/locks/TXLockServiceImpl.java | 5 +++++
3 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8c71023b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXLockRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXLockRequest.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXLockRequest.java
index 06c7572..323d98e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXLockRequest.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXLockRequest.java
@@ -94,11 +94,9 @@ public class TXLockRequest {
* Release any distributed locks obtained by this request
*/
public void releaseDistributed() {
+ TXLockService txls = TXLockService.createDTLS();
if (this.distLockId != null) {
- try {
- TXLockService.createDTLS().release(this.distLockId);
- } catch (IllegalStateException ignore) {
- }
+ txls.release(this.distLockId);
this.distLockId = null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8c71023b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java
index d64426b..3223f12 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java
@@ -778,6 +778,7 @@ public class TXState implements TXStateInterface {
}
protected void cleanup() {
+ IllegalArgumentException iae = null;
try {
this.closed = true;
this.seenEvents.clear();
@@ -785,7 +786,11 @@ public class TXState implements TXStateInterface {
freePendingCallbacks();
if (this.locks!=null) {
final long conflictStart = CachePerfStats.getStatTime();
- this.locks.cleanup();
+ try {
+ this.locks.cleanup();
+ } catch (IllegalArgumentException e) {
+ iae = e;
+ }
if (CachePerfStats.enableClockStats)
this.proxy.getTxMgr().getCachePerfStats().incTxConflictCheckTime(CachePerfStats.getStatTime()-conflictStart);
}
@@ -823,6 +828,9 @@ public class TXState implements TXStateInterface {
synchronized(this.completionGuard) {
this.completionGuard.notifyAll();
}
+ if (iae != null && !this.proxy.getCache().isClosed()) {
+ throw iae;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8c71023b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceImpl.java
index b32d3a5..cb84845 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceImpl.java
@@ -224,6 +224,11 @@ public class TXLockServiceImpl extends TXLockService {
public void release(TXLockId txLockId) {
synchronized (this.txLockIdList) {
if (!this.txLockIdList.contains(txLockId)) {
+ //TXLockService.destroyServices can be invoked in cache.close().
+ //Other P2P threads could process message such as TXCommitMessage afterwards,
+ //and invoke TXLockService.createDTLS(). It could create a new TXLockService
+ //which will have a new empty list (txLockIdList) and it will not
+ //contain the originally added txLockId
throw new IllegalArgumentException(LocalizedStrings.TXLockServiceImpl_INVALID_TXLOCKID_NOT_FOUND_0.toLocalizedString(txLockId));
}
// only release w/ dlock if not in middle of recovery...