-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8206187: javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java fails with Port already in use #7589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…terTest.java fails with Port already in use
|
👋 Welcome back kevinw! A progress list of the required criteria for merging this PR into |
|
@kevinjwalls The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
|
This is reasonable approach to take and should ameliorate the BindException failure condition. An alternative is to use a fixed port 1098, which previously was the default for RMI Activation daemon. |
|
The test uses warm-up predicate in a strange way - it returns true for any output from child process. |
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. |
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-) Anyway... |
| private static final String TEST_APP_NAME = "TestApp"; | ||
| private static final int FREE_PORT_ATTEMPTS = 10; | ||
|
|
||
| private static void testDefaultAgent(String propertyFile) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good refactoring change as it also removes some broken logic in the current retry strategy
|
@kevinjwalls This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 23 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
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. |
|
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 |
|
/integrate |
|
Going to push as commit cd36be4.
Your commit was automatically rebased without conflicts. |
|
@kevinjwalls Pushed as commit cd36be4. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7589/head:pull/7589$ git checkout pull/7589Update a local copy of the PR:
$ git checkout pull/7589$ git pull https://git.openjdk.java.net/jdk pull/7589/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7589View PR using the GUI difftool:
$ git pr show -t 7589Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7589.diff