Ping: RFR: JDK-8249550: jdb should use loopback address when not using remote agent

Alex Menkov alexey.menkov at oracle.com
Wed Aug 5 21:08:13 UTC 2020


Hi Serguei,

Original issue is about jdb with CommandLineLaunch connector on 
non-Windows systems tries to resolve hostname and start to listening on it.
This behavior can cause error (this is what the bug about) and does not 
makes sense and CommandLineLaunch connector launches local process, so 
there is no sense to listen for connections from other hosts.

SocketTransportService is also used for jdb "listen" and "listenany" 
commands, but this commands require address to be specified, so 
startListening(String) is called, not startListening().

So the only behavior change is a debuggee started by CommandLineLaunch 
connector accepts debuggers only from local machine, but this is how jdb 
works (it starts local process and connects to it).
I don't think this requires CSR.

--alex

On 08/04/2020 17:22, serguei.spitsyn at oracle.com wrote:
> Hi Alex,
> 
> This looks good to me.
> But do we need a CSR for this?
> I understand that the intention is to comply with the TransportService 
> spec but the behavior is being changed.
> How long did we have this behavior?
> 
> Thanks,
> Serguei
> 
> 
> On 8/4/20 16:32, Alex Menkov wrote:
>> Needs one more reviewer.
>>
>> One more details to simplify review.
>> SocketTransportService extends TransportService and spec for 
>> TransportService.startListening() is:
>>
>>     /**
>>      * Listens on an address chosen by the transport service.
>>      *
>>      * <p> This convenience method works as if by invoking
>>      * {@link #startListening(String) startListening(null)}.
>>      *
>>      * @return  a listen key to be used in subsequent calls to be
>>      *          {@link #accept accept} or {@link #stopListening
>>      *          stopListening} methods.
>>      *
>>      * @throws  IOException
>>      *          If an I/O error occurs.
>>      */
>>     public abstract ListenKey startListening() throws IOException;
>>
>> I.e. the fix updates SocketTransportService  to comply the spec.
>>
>> --alex
>>
>> On 07/23/2020 13:05, Chris Plummer wrote:
>>> Hi Alex,
>>>
>>> I'm no expert in this area, but the changes appear to do what you 
>>> describe (use the loopback address), so thumbs up.
>>>
>>> thanks,
>>>
>>> Chris
>>>
>>> On 7/21/20 3:04 PM, Alex Menkov wrote:
>>>> Hi all,
>>>>
>>>> please review the fix for
>>>> https://bugs.openjdk.java.net/browse/JDK-8249550
>>>>
>>>> webrev:
>>>> http://cr.openjdk.java.net/~amenkov/jdk16/jdb_loopback/webrev/
>>>>
>>>> some background:
>>>> https://bugs.openjdk.java.net/browse/JDK-8041435 made default 
>>>> listening on loopback address.
>>>> Later https://bugs.openjdk.java.net/browse/JDK-8184770 added 
>>>> handling of "*" address to listen on all addresses, but it didn't 
>>>> fixed "default" startListening() method (used by jdb through 
>>>> SunCommandLineLauncher).
>>>>
>>>> The method called startListening(String localaddress, int port) with 
>>>> localaddress == null, but this method for null localladdress starts 
>>>> listening on all addresses (i.e. handle null value as "*").
>>>> The fix changes it to startListening(String address) which handles 
>>>> null address the same way as JDI socket connector does (i.e. listens 
>>>> on loopback address only)
>>>>
>>>> --alex
>>>
> 


More information about the serviceability-dev mailing list