-
Bug
-
Resolution: Won't Fix
-
P3
-
6
-
None
-
sparc
-
solaris_9
We call "rmic -iiop" to generate a Tie class for our JMX IIOP connector, and we get a NullPointerException time to time from the Tie class when running our unit tests.
After having a look at the generated Tie class _RMIConnectionImpl_Tie.java (attached), we find the problem is from the variable "target". This variable can be changed by the methods "setTargetsetTarget" and "deactivate()", and be used directly by the method "_invoke" for a client request.
The problem occurs when a thread disconnecting the client calls "setTargetsetTarget" and "deactivate()" to set null to the target, one another thread calling "_invoke" for a client request gets NullPointerException because of null "target". In fact no any synchronization protection for the variable "target".
One possible solution is to add a new private method:
private Remote returnTarget() throws IOException {
final Remote t = target;
if (t == null) {
// closed?
throw new IOException(...);
}
return t;
}
and the method "_invoke" gets a "target" instance by calling this method.
The same problem appears to jdk1.4 and jdk1.5
After having a look at the generated Tie class _RMIConnectionImpl_Tie.java (attached), we find the problem is from the variable "target". This variable can be changed by the methods "setTargetsetTarget" and "deactivate()", and be used directly by the method "_invoke" for a client request.
The problem occurs when a thread disconnecting the client calls "setTargetsetTarget" and "deactivate()" to set null to the target, one another thread calling "_invoke" for a client request gets NullPointerException because of null "target". In fact no any synchronization protection for the variable "target".
One possible solution is to add a new private method:
private Remote returnTarget() throws IOException {
final Remote t = target;
if (t == null) {
// closed?
throw new IOException(...);
}
return t;
}
and the method "_invoke" gets a "target" instance by calling this method.
The same problem appears to jdk1.4 and jdk1.5
- relates to
-
JDK-6384126 NPE from SharedCDRClientRequestDispatcherImpl
-
- Closed
-
-
JDK-7144846 org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke throws NPE intermittently
-
- Closed
-
-
JDK-6610298 NPE from JMX IIOP Connector
-
- Closed
-