-
Bug
-
Resolution: Duplicate
-
P4
-
21
We are seeing data race reported by tsan in java.lang.reflect.ProxyGenerator.addProxyMethod(). I did some analysis of the tsan report. It appears there are two different threads read/write a shared (same) ProxyMethod concurrently, while processing two different annotations. One thread is reading a ProxyMethod.exceptionTypes and the other thread is writing the ProxyMethod.exceptionTypes field from the same object.
ProxyGenerator.generateProxyClass() always creates a new ProxyGenerator instance and ProxyGenerator.proxyMethods map is private to each ProxyGenerator instance. In most cases, the ProxyMethod instances handled by generateProxyClass() are private to the invoking thread.
[~jcking] noticed there are following static fields in ProxyGenerator class. Those could be accessed from different threads.
```
/* Preloaded ProxyMethod objects for methods in java.lang.Object */
private static final ProxyMethod hashCodeMethod;
private static final ProxyMethod equalsMethod;
private static final ProxyMethod toStringMethod;
```
It would be good for someone who's familiar with the ProxyGenerator area to take a close look to see if the reported race is benign or needs to be fixed.
ProxyGenerator.generateProxyClass() always creates a new ProxyGenerator instance and ProxyGenerator.proxyMethods map is private to each ProxyGenerator instance. In most cases, the ProxyMethod instances handled by generateProxyClass() are private to the invoking thread.
[~jcking] noticed there are following static fields in ProxyGenerator class. Those could be accessed from different threads.
```
/* Preloaded ProxyMethod objects for methods in java.lang.Object */
private static final ProxyMethod hashCodeMethod;
private static final ProxyMethod equalsMethod;
private static final ProxyMethod toStringMethod;
```
It would be good for someone who's familiar with the ProxyGenerator area to take a close look to see if the reported race is benign or needs to be fixed.
- duplicates
-
JDK-8333854 IllegalAccessError with proxies after JDK-8332457
-
- Closed
-