RFR(XS): 8048050: Agent NullPointerException when rmi.port in use

Sergey Gabdurakhmanov sergey.gabdurakhmanov at oracle.com
Fri Nov 14 16:23:21 UTC 2014


Hi Daniel,

Our documentation does not specify the exact exception that should be thrown in this scenario. But it should be reasonable.
That makes testcase very difficult to implement. Because "reasonable" is not clear for test.
E.g. "divided by zero" is not reasonable, but "illegal argument" is...
I prefer do not put any tests where.

BR,
Sergey

----- Original Message -----
From: daniel.fuchs at oracle.com
To: jaroslav.bachorik at oracle.com, sergey.gabdurakhmanov at oracle.com, hotspot-runtime-dev at openjdk.java.net, dmitry.samersoff at oracle.com, serviceability-dev at openjdk.java.net
Sent: Friday, November 14, 2014 4:32:38 PM (GMT+0300) Auto-Detected
Subject: Re: RFR(XS): 8048050: Agent NullPointerException when rmi.port in use

Hi Sergey,

The fix looks fine.
I wonder whether there should be a testcase for that?

best regards,

-- daniel

On 14/11/14 14:10, Jaroslav Bachorik wrote:
>
> Good to go.
>
> -JB-
>
> On 11/14/2014 02:07 PM, Sergey Gabdurakhmanov wrote:
>> Hi,
>>
>> Could I please have a review of this small fix.
>>
>> webrev: http://cr.openjdk.java.net/~sgabdura/8048050/webrev.00/
>> bug: https://bugs.openjdk.java.net/browse/JDK-8048050
>>
>> Problem description:
>> If the com.sun.management.jmxremote.rmi.port option is provided it will
>> give a NPE if already in use by a different JVM. Its expected to fail
>> but should provide an appropriate exception.
>>
>> STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
>> Run two instances in different JVMs at same time with the following
>> options:
>> -Dcom.sun.management.jmxremote.port=2222
>> -Dcom.sun.management.jmxremote.rmi.port=2223
>> -Dcom.sun.management.jmxremote.authenticate=false
>>
>> Root cause:
>> Then we trying to start JMXConnectorServer (see method exportMBeanServer
>> of class sun.management.jmxremote.ConnectorBootstrap on already used
>> port it cause IOException. Call of connServer.getAddress().toString() in
>> the exception handler cause NullPointerException because
>> connServer.getAddress() returns null.
>>
>> Solution:
>> Provide url.toString() if connServer.getAddress() is null
>>
>> I'm going to push this fix into JDK9, 8 and 7.
>>
>> BR,
>> Sergey
>>
>



More information about the serviceability-dev mailing list