RFR: 7903730: Enhance the agentvm to be tolerant to unexpected connection on the port the Agent listens on for handshake with the AgentServer [v2]
Jaikiran Pai
jpai at openjdk.org
Mon May 20 13:59:14 UTC 2024
On Mon, 20 May 2024 13:50:44 GMT, Ludvig Janiuk <lujaniuk at openjdk.org> wrote:
> Is this the point where the agent would break the connection if the magic bytes are wrong?
That happens in the `Agent` code in the newly introduced `acceptAndHandshake()` method https://github.com/openjdk/jtreg/pull/195/files#diff-23190c9a688c97b3edf1b5605b78eefb8ebe4b5894737518072c6efb55705401R252. The `Agent` is the server side of the socket connection, listening for a connection, and the `AgentServer` is the client side of the socket connection sending a connection request. Yes, it's a bit confusing since the class is named `AgentServer`, but it does act as a server later on, serving test execution requests from the jtreg's `Agent`.
> src/share/classes/com/sun/javatest/regtest/exec/Agent.java line 264:
>
>> 262: s.close();
>> 263: } catch (IOException ignored) {
>> 264: // ignore
>
> Please don't swallow exceptions.
In this case it's intentional. Here we are closing a unexpected/rogue connection and if any errors result during that close, we don't want to propagate it nor do I think we want to print a stacktrace for it.
-------------
PR Review Comment: https://git.openjdk.org/jtreg/pull/195#discussion_r1606815195
PR Review Comment: https://git.openjdk.org/jtreg/pull/195#discussion_r1606817512
More information about the jtreg-dev
mailing list