Thanks for the feedback everyone.

Hi Alan, yes I can put some cycles into digging deeper with this one, as 
you point out there's probably more that needs doing.
As Alex found running the new testcase 400 times it failed once still, 
interestingly during initial startListening() rather than the accept() 
where it was failing before.
On a general issue of "thread-safety", I had a good look through the spec 
docs and architecture docs and couldn't find any specification of 
thread-safety(or not), should it be inferred if the docs don't 
specifically state "thread-safe" that it should be assumed as "not-thread 
safe"?

Thanks
Andrew

Andrew Leonard
Java Runtimes Development
IBM Hursley
IBM United Kingdom Ltd
internet email: andrew_m_leon...@uk.ibm.com 




From:   Alan Bateman <alan.bate...@oracle.com>
To:     "serguei.spit...@oracle.com" <serguei.spit...@oracle.com>, Andrew 
Leonard <andrew_m_leon...@uk.ibm.com>, serviceability-dev@openjdk.java.net
Date:   08/06/2019 10:12
Subject:        Re: RFR JDK-8225474: JDI connector accept fails "Address 
already in use" with concurrent listeners



On 08/06/2019 05:53, serguei.spit...@oracle.com wrote:
> Hi Andrew,
>
> It looks good to me.
> Thank you for your investigation and taking care about this!
I think this one needs further analysis as changing listenMap to be a 
CHM does not make this connector thread safe and doesn't address a 
number of other places where the map is accessed without 
synchronization. For example, startListening would need to be changed to 
use `putIfAbsent`, stopListening would need to use `remove` rather than 
get + remote. There are several others once you start looking at the 
sub-classes, e.g. SocketListeningConnector.updateArgumentMapIfRequired.

At the API level, JDI does not require connectors to be thread safe. I 
agree it is desirable for some of the connector implementations to be 
thread safe, particularly ListeningConnectors as an obvious usage will 
be for a listener thread to hand off a VirtualMachine to another thread.

Andrew - do you have cycles to investigate this further? I'm not opposed 
to changing the map to be a CHM but I think it needs further work.

-Alan




Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Reply via email to