RFR: 8201183: sjavac build failures: "Connection attempt failed: Connection refused"

Daniel Jeliński djelinski at openjdk.org
Wed Apr 10 12:27:29 UTC 2024


The "Connection attempt failed: Connection refused" error may happen if the client tries to connect to a server that is no longer listening, which in turn may happen if the server shuts down without removing the port file. I added a check that the delete operation succeeded, and retry as necessary.

I removed the comment about asynchronous deletes on Windows. I don't think it's correct; it's more likely that the file existed because the delete operation failed.

I added a 1 second delay after deleting the port file; this delay is intended to allow any clients that managed to read the port file before it was deleted to finish connecting. It should also take care of the "IOException caught during compilation: Connection reset" issue.

And finally, the portfile is now closed when not in use. This was necessary to fix the failures on Windows, where the file cannot be deleted as long as it is open in any process.

In order to verify the fix, I modified `IdleMonitor.KEEPALIVE` to 1 second. Without the changes from this PR this resulted in at least a few failures in every mach5 run. With this PR I was able to build tier1-5 with no failures.

-------------

Commit messages:
 - Close port file after use
 - Check delete result

Changes: https://git.openjdk.org/jdk/pull/18712/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18712&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8201183
  Stats: 32 lines in 1 file changed: 12 ins; 8 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/18712.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18712/head:pull/18712

PR: https://git.openjdk.org/jdk/pull/18712


More information about the build-dev mailing list