RFR: 7903730: Enhance the agentvm to be tolerant to unexpected connection on the port the Agent listens on for handshake with the AgentServer [v3]
Jaikiran Pai
jpai at openjdk.org
Fri Jun 7 11:42:25 UTC 2024
On Thu, 23 May 2024 13:21:08 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:
>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>>
>> reduce the scope of the try/catch and fix potential short read() issue
>
> src/share/classes/com/sun/javatest/regtest/agent/AgentServer.java line 219:
>
>> 217: if (port > 0) {
>> 218: log("Connecting to " + host + ":" + port);
>> 219: Socket s = new Socket(host, port);
>
> This only works if the host argument is not specified on the AgentServer command line, as the Agent now listens on the loopback address and no longer the wildcard address.
> Typically the host argument, in the launching command line of the AgentServer, is not specified. But now an Agent is listening on loopback address making the -host argument redundant. So maybe -host should be removed from common line processing
Hello Mark, I read this a couple of times but didn't fully understand this suggestion. Right now the `host` variable gets default set to loopback address:
// by default use loopback address. if "-host" is specified, this will
// then be overridden by that value
InetAddress host = InetAddress.getLoopbackAddress();
but as the code comment states, if the `AgentServer` program was launched with a `-host <val>` then the `host` variable here is updated/set to the new value that is provided to value. So when the code does indeed reach the point of calling this `Socket` constructor, the `host` variable would have the correct host.
Did I misunderstand your suggestion?
-------------
PR Review Comment: https://git.openjdk.org/jtreg/pull/195#discussion_r1631079703
More information about the jtreg-dev
mailing list