[jdk9] RFR: 8159822: Non-synchronized access to shared members of com.sun.jndi.ldap.pool.Pool
Aleksey Shipilev
aleksey.shipilev at oracle.com
Tue Jun 21 15:43:32 UTC 2016
On 06/21/2016 06:14 PM, Ivan Gerasimov wrote:
> Hello!
>
> The Pool has a member `map`, which is accessed from different threads,
> thus the access is synchronized.
> However, in some code paths (mostly in debug printing) it is accessed
> without proper synchronization, which results in intermediate
> ConcurrentModificationException when the debug output is turned on.
>
> Would you please help review the fix?
>
> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8159822
> WEBREV: http://cr.openjdk.java.net/~igerasim/8159822/00/webrev/
Missed synchronized-s:
154 private Connections getConnections(Object id) {
155 ConnectionsRef ref = map.get(id);
156 return (ref != null) ? ref.getConnections() : null;
157 }
...gets called via:
168 public void expire(long threshold) {
169 synchronized (map) {
...
179 }
180 expungeStaleConnections();
181 }
...and also via:
188 private static void expungeStaleConnections() {
...
192 Connections conns = releaseRef.getConnections();
...
203 }
204 }
...
117 public PooledConnection getPooledConnection(Object id, long
timeout,
118 PooledConnectionFactory factory) throws NamingException {
...
// no synchronized prior here
127 expungeStaleConnections();
...
Thanks,
-Aleksey
More information about the core-libs-dev
mailing list