From kevinw at openjdk.java.net Mon Feb 7 17:34:29 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Mon, 7 Feb 2022 17:34:29 GMT Subject: jmx-dev RFR: 6779701: Wrong defect ID in the code of test LocalRMIServerSocketFactoryTest.java Message-ID: Trivial comment and exception text update, correcting a bug ID to make more sense. ------------- Commit messages: - 6779701: Wrong defect ID in the code of test LocalRMIServerSocketFactoryTest.java Changes: https://git.openjdk.java.net/jdk/pull/7371/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7371&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-6779701 Stats: 6 lines in 1 file changed: 0 ins; 0 del; 6 mod Patch: https://git.openjdk.java.net/jdk/pull/7371.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7371/head:pull/7371 PR: https://git.openjdk.java.net/jdk/pull/7371 From cjplummer at openjdk.java.net Mon Feb 7 17:46:08 2022 From: cjplummer at openjdk.java.net (Chris Plummer) Date: Mon, 7 Feb 2022 17:46:08 GMT Subject: jmx-dev RFR: 6779701: Wrong defect ID in the code of test LocalRMIServerSocketFactoryTest.java In-Reply-To: References: Message-ID: On Mon, 7 Feb 2022 17:28:29 GMT, Kevin Walls wrote: > Trivial comment and exception text update, correcting a bug ID to make more sense. Marked as reviewed by cjplummer (Reviewer). ------------- PR: https://git.openjdk.java.net/jdk/pull/7371 From dfuchs at openjdk.java.net Mon Feb 7 18:12:15 2022 From: dfuchs at openjdk.java.net (Daniel Fuchs) Date: Mon, 7 Feb 2022 18:12:15 GMT Subject: jmx-dev RFR: 6779701: Wrong defect ID in the code of test LocalRMIServerSocketFactoryTest.java In-Reply-To: References: Message-ID: On Mon, 7 Feb 2022 17:28:29 GMT, Kevin Walls wrote: > Trivial comment and exception text update, correcting a bug ID to make more sense. LGTM ------------- Marked as reviewed by dfuchs (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/7371 From kevinw at openjdk.java.net Mon Feb 7 18:19:10 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Mon, 7 Feb 2022 18:19:10 GMT Subject: jmx-dev RFR: 6779701: Wrong defect ID in the code of test LocalRMIServerSocketFactoryTest.java In-Reply-To: References: Message-ID: On Mon, 7 Feb 2022 17:28:29 GMT, Kevin Walls wrote: > Trivial comment and exception text update, correcting a bug ID to make more sense. Thanks Chris, thanks Daniel! ------------- PR: https://git.openjdk.java.net/jdk/pull/7371 From kevinw at openjdk.java.net Mon Feb 7 18:19:10 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Mon, 7 Feb 2022 18:19:10 GMT Subject: jmx-dev Integrated: 6779701: Wrong defect ID in the code of test LocalRMIServerSocketFactoryTest.java In-Reply-To: References: Message-ID: On Mon, 7 Feb 2022 17:28:29 GMT, Kevin Walls wrote: > Trivial comment and exception text update, correcting a bug ID to make more sense. This pull request has now been integrated. Changeset: 8a662105 Author: Kevin Walls URL: https://git.openjdk.java.net/jdk/commit/8a662105c2da1f0fb9b7ecc5058fc85858439ed9 Stats: 6 lines in 1 file changed: 0 ins; 0 del; 6 mod 6779701: Wrong defect ID in the code of test LocalRMIServerSocketFactoryTest.java Reviewed-by: cjplummer, dfuchs ------------- PR: https://git.openjdk.java.net/jdk/pull/7371 From kevinw at openjdk.java.net Wed Feb 23 14:15:18 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Wed, 23 Feb 2022 14:15:18 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use Message-ID: Test fails occasionally due to a port clash. Presumably the port that was returned by Utils.getFreePort(), is no longer free. The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. It should retry with a new port if we fail due to a port in use, for some limited number of attempts. main already has some retry logic, but not working: it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. So... Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. ------------- Commit messages: - Remove tab. - Throw on last retry if port clash persists. - Merge remote-tracking branch 'upstream/master' into 8206187_DefaultAgentFilterTest - 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use Changes: https://git.openjdk.java.net/jdk/pull/7589/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7589&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8206187 Stats: 73 lines in 1 file changed: 25 ins; 29 del; 19 mod Patch: https://git.openjdk.java.net/jdk/pull/7589.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7589/head:pull/7589 PR: https://git.openjdk.java.net/jdk/pull/7589 From msheppar at openjdk.java.net Wed Feb 23 17:22:49 2022 From: msheppar at openjdk.java.net (Mark Sheppard) Date: Wed, 23 Feb 2022 17:22:49 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use In-Reply-To: References: Message-ID: On Wed, 23 Feb 2022 13:59:19 GMT, Kevin Walls wrote: > Test fails occasionally due to a port clash. > Presumably the port that was returned by Utils.getFreePort(), is no longer free. > The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. > It should retry with a new port if we fail due to a port in use, for some limited number of attempts. > > main already has some retry logic, but not working: > it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). > TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. > Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. > > So... > > Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. > Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. This is reasonable approach to take and should ameliorate the BindException failure condition. But, as it is using the same port allocation strategy which is in current use, then it will be still be suspect to intermittent BindException failures. This will be especially true, as with the current failures, there is a lot of network testing activity with concurrent network test execution and the MACH5 test framework itself e.g. logstash etc. An alternative is to use a fixed port 1098, which previously was the default for RMI Activation daemon. This is now available as activation has been removed from the java platform in JDK17. ------------- PR: https://git.openjdk.java.net/jdk/pull/7589 From amenkov at openjdk.java.net Wed Feb 23 17:45:53 2022 From: amenkov at openjdk.java.net (Alex Menkov) Date: Wed, 23 Feb 2022 17:45:53 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use In-Reply-To: References: Message-ID: <_KkuygOYarPELAzDh2OC8TelGKgMzjg-llUkCQIxeDk=.7031205c-a4e5-489a-b879-04953fd133a4@github.com> On Wed, 23 Feb 2022 13:59:19 GMT, Kevin Walls wrote: > Test fails occasionally due to a port clash. > Presumably the port that was returned by Utils.getFreePort(), is no longer free. > The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. > It should retry with a new port if we fail due to a port in use, for some limited number of attempts. > > main already has some retry logic, but not working: > it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). > TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. > Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. > > So... > > Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. > Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. The test uses warm-up predicate in a strange way - it returns true for any output from child process. The main purpose of the predicate is to wait until some expected output is produced, and return false to skip other lines (for example in some environments VM may print some warnings). For this test it may be "main enter" (printed from TestApp.main()). To handle "port in use" error the predicate can search for "bindexception" or "port already in use" line. I don't think check for "exception" and "error" makes much sense here. ------------- PR: https://git.openjdk.java.net/jdk/pull/7589 From kevinw at openjdk.java.net Thu Feb 24 10:33:05 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Thu, 24 Feb 2022 10:33:05 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use In-Reply-To: References: Message-ID: On Wed, 23 Feb 2022 17:19:16 GMT, Mark Sheppard wrote: > An alternative is to use a fixed port 1098 Thanks Mark - I will avoid that fixed slot as we no doubt run tests concurrently, and also in case these get backported far enough that it's not free. 8-) Utils.getFreePort() lets new ServerSocket choose a port, but there's clearly a race to use it. We could make it simply random, but I think we need still need to retry like this to avoid failures -- will monitor and see how the race goes with 10 attempts. ------------- PR: https://git.openjdk.java.net/jdk/pull/7589 From kevinw at openjdk.java.net Thu Feb 24 11:40:03 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Thu, 24 Feb 2022 11:40:03 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use In-Reply-To: <_KkuygOYarPELAzDh2OC8TelGKgMzjg-llUkCQIxeDk=.7031205c-a4e5-489a-b879-04953fd133a4@github.com> References: <_KkuygOYarPELAzDh2OC8TelGKgMzjg-llUkCQIxeDk=.7031205c-a4e5-489a-b879-04953fd133a4@github.com> Message-ID: On Wed, 23 Feb 2022 17:42:35 GMT, Alex Menkov wrote: > The test uses warm-up predicate in a strange way Thanks Alex - yes so that's why we only see one line in the predicate, it contains the word "exception" and the predicate returns true, signalling that the process is done starting up. 8-) But if you do see an exception, you're never going to see the text from the app that it has started OK, so I see why it was returning true always - we were either seeing an error, or otherwise we presume TestApp has started. But it returned true after seeing the first line, which does not contain "bindexception", so it never saw the BindException later to recognise the port being in use. Anyway... I will update shortly to hopefully clarify the predicate part. Still good to keep main() simpler and not have duplicated retry logic there. ------------- PR: https://git.openjdk.java.net/jdk/pull/7589 From kevinw at openjdk.java.net Thu Feb 24 12:17:54 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Thu, 24 Feb 2022 12:17:54 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use [v2] In-Reply-To: References: Message-ID: > Test fails occasionally due to a port clash. > Presumably the port that was returned by Utils.getFreePort(), is no longer free. > The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. > It should retry with a new port if we fail due to a port in use, for some limited number of attempts. > > main already has some retry logic, but not working: > it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). > TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. > Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. > > So... > > Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. > Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. Kevin Walls has updated the pull request incrementally with one additional commit since the last revision: Clarify predicate usage. ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/7589/files - new: https://git.openjdk.java.net/jdk/pull/7589/files/a1bc3d0e..6cdcde8a Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7589&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7589&range=00-01 Stats: 10 lines in 1 file changed: 4 ins; 1 del; 5 mod Patch: https://git.openjdk.java.net/jdk/pull/7589.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7589/head:pull/7589 PR: https://git.openjdk.java.net/jdk/pull/7589 From msheppar at openjdk.java.net Thu Feb 24 12:49:04 2022 From: msheppar at openjdk.java.net (Mark Sheppard) Date: Thu, 24 Feb 2022 12:49:04 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use [v2] In-Reply-To: References: Message-ID: <4mGs7EgpTyMNS9IK-IVWUVvCiAuos9LEgggOngjqFvM=.fa120324-1ce7-4094-af5b-52974a0d20db@github.com> On Thu, 24 Feb 2022 12:17:54 GMT, Kevin Walls wrote: >> Test fails occasionally due to a port clash. >> Presumably the port that was returned by Utils.getFreePort(), is no longer free. >> The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. >> It should retry with a new port if we fail due to a port in use, for some limited number of attempts. >> >> main already has some retry logic, but not working: >> it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). >> TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. >> Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. >> >> So... >> >> Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. >> Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. > > Kevin Walls has updated the pull request incrementally with one additional commit since the last revision: > > Clarify predicate usage. Marked as reviewed by msheppar (Reviewer). test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java line 174: > 172: private static final int FREE_PORT_ATTEMPTS = 10; > 173: > 174: private static void testDefaultAgent(String propertyFile) throws Exception { This is a good refactoring change as it also removes some broken logic in the current retry strategy ------------- PR: https://git.openjdk.java.net/jdk/pull/7589 From amenkov at openjdk.java.net Thu Feb 24 13:14:10 2022 From: amenkov at openjdk.java.net (Alex Menkov) Date: Thu, 24 Feb 2022 13:14:10 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use [v2] In-Reply-To: References: Message-ID: On Thu, 24 Feb 2022 12:17:54 GMT, Kevin Walls wrote: >> Test fails occasionally due to a port clash. >> Presumably the port that was returned by Utils.getFreePort(), is no longer free. >> The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. >> It should retry with a new port if we fail due to a port in use, for some limited number of attempts. >> >> main already has some retry logic, but not working: >> it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). >> TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. >> Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. >> >> So... >> >> Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. >> Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. > > Kevin Walls has updated the pull request incrementally with one additional commit since the last revision: > > Clarify predicate usage. Marked as reviewed by amenkov (Reviewer). ------------- PR: https://git.openjdk.java.net/jdk/pull/7589 From kevinw at openjdk.java.net Thu Feb 24 15:02:40 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Thu, 24 Feb 2022 15:02:40 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use [v3] In-Reply-To: References: Message-ID: > Test fails occasionally due to a port clash. > Presumably the port that was returned by Utils.getFreePort(), is no longer free. > The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. > It should retry with a new port if we fail due to a port in use, for some limited number of attempts. > > main already has some retry logic, but not working: > it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). > TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. > Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. > > So... > > Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. > Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. Kevin Walls has updated the pull request incrementally with one additional commit since the last revision: break to terminate retry loop when succesful ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/7589/files - new: https://git.openjdk.java.net/jdk/pull/7589/files/6cdcde8a..33649830 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7589&range=02 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7589&range=01-02 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.java.net/jdk/pull/7589.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7589/head:pull/7589 PR: https://git.openjdk.java.net/jdk/pull/7589 From kevinw at openjdk.java.net Thu Feb 24 15:02:42 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Thu, 24 Feb 2022 15:02:42 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use [v2] In-Reply-To: References: Message-ID: <2wuW-h6ZQ4qTmPhHo89cfvY64q8jrWjUI0MQMPZGy8Y=.cd822605-743b-4d42-b4b5-fdc9d2491c2c@github.com> On Thu, 24 Feb 2022 12:17:54 GMT, Kevin Walls wrote: >> Test fails occasionally due to a port clash. >> Presumably the port that was returned by Utils.getFreePort(), is no longer free. >> The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. >> It should retry with a new port if we fail due to a port in use, for some limited number of attempts. >> >> main already has some retry logic, but not working: >> it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). >> TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. >> Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. >> >> So... >> >> Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. >> Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. > > Kevin Walls has updated the pull request incrementally with one additional commit since the last revision: > > Clarify predicate usage. Thanks for the reviews! Apologies, one more update - I had a break in there earlier to terminate the retry loop, and I removed it accidentally when changing things to make it fail. The retry loop has to let the testDefaultAgent method complete normally (which needs the break), or by throwing an Exception. Both looking good now. ------------- PR: https://git.openjdk.java.net/jdk/pull/7589 From msheppar at openjdk.java.net Thu Feb 24 23:40:12 2022 From: msheppar at openjdk.java.net (Mark Sheppard) Date: Thu, 24 Feb 2022 23:40:12 GMT Subject: jmx-dev RFR: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use [v3] In-Reply-To: References: Message-ID: On Thu, 24 Feb 2022 15:02:40 GMT, Kevin Walls wrote: >> Test fails occasionally due to a port clash. >> Presumably the port that was returned by Utils.getFreePort(), is no longer free. >> The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. >> It should retry with a new port if we fail due to a port in use, for some limited number of attempts. >> >> main already has some retry logic, but not working: >> it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). >> TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. >> Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. >> >> So... >> >> Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. >> Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. > > Kevin Walls has updated the pull request incrementally with one additional commit since the last revision: > > break to terminate retry loop when succesful Marked as reviewed by msheppar (Reviewer). A good spot by yourself ... as the focus was on the BindException correction and the pass condition is an Exception being thrown, it was easy to miss the break for a failure condition ... a similar issue existed in the current test albeit only if an InvocationTargetException with a nested BindException was thrown and the retry resulted in the InvalidClassException or UnmarcshalledException !! ------------- PR: https://git.openjdk.java.net/jdk/pull/7589 From kevinw at openjdk.java.net Fri Feb 25 08:00:02 2022 From: kevinw at openjdk.java.net (Kevin Walls) Date: Fri, 25 Feb 2022 08:00:02 GMT Subject: jmx-dev Integrated: 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use In-Reply-To: References: Message-ID: On Wed, 23 Feb 2022 13:59:19 GMT, Kevin Walls wrote: > Test fails occasionally due to a port clash. > Presumably the port that was returned by Utils.getFreePort(), is no longer free. > The test creates a ProcessBuilder with the parameters for JMX, including port number, and uses that to create a new Process. > It should retry with a new port if we fail due to a port in use, for some limited number of attempts. > > main already has some retry logic, but not working: > it checks for an InvocationTargetException to contain a BindException, but it simply gets a BindException, thrown by TestAppRun.start(). > TestAppRun.start() runs the new process and scans for errors, but on failure its predicate has only seen the first line of a failure, so a BindException is never recognised and thrown. > Also main does not limit the retries, and handling the port retry in main() is duplicated, for each run of the test method. > > So... > > Make the error-scanning predicate in TestAppRun recognise a "port in use" message and throw a BindExeption. This is a notification to the caller that it failed, it's not the actual BindException as that was thrown in a different process. > Make the testDefaultAgent method (the main part of the test) handle retrying with a new port, a limited number of times. This pull request has now been integrated. Changeset: cd36be42 Author: Kevin Walls URL: https://git.openjdk.java.net/jdk/commit/cd36be42c2eb3eacdb3625e87510eb15acac3230 Stats: 82 lines in 1 file changed: 30 ins; 30 del; 22 mod 8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use Reviewed-by: msheppar, amenkov ------------- PR: https://git.openjdk.java.net/jdk/pull/7589