Darrel Schneider created GEODE-6927: ---------------------------------------
Summary: possible NPE in ConnectionTable.getThreadOwnedConnection if concurrent close Key: GEODE-6927 URL: https://issues.apache.org/jira/browse/GEODE-6927 Project: Geode Issue Type: Bug Components: messaging Reporter: Darrel Schneider ConnectionTable.getThreadOwnedConnection has a couple of usages of "this.threadConnectionMap" that could result in an NPE if the ConnectionTable is concurrently closed. The unsafe code: {code:java} if (this.threadConnectionMap == null) { // This instance is being destroyed; fail the operation closeCon( "Connection table being destroyed", result); return null; } ArrayList al = (ArrayList) this.threadConnectionMap.get(id); if (al == null) { // First connection for this DistributedMember. Make sure list for this // stub is created if it isn't already there. al = new ArrayList(); // Since it's a concurrent map, we just try to put it and then // return whichever we got. Object o = this.threadConnectionMap.putIfAbsent(id, al); if (o != null) { al = (ArrayList) o; } } {code} If a close happens after the initial null check but before either the get or putIfAbsent call then a NPE will be thrown. All the other code that uses "threadConnectionMap" is careful to save it into a local var, and then use the local var. That is all that is needed here to make this code thread safe. -- This message was sent by Atlassian JIRA (v7.6.3#76005)