-
Notifications
You must be signed in to change notification settings - Fork 6.2k
JDK-8223322: Improve concurrency in jpackage instances #1829
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
|
👋 Welcome back herrick! A progress list of the required criteria for merging this PR into |
|
@andyherrick The following label 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 list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
|
Changes looks fine, but are we sure that external 3rd party tools used by jpackage will work concurrently without any issues? |
| final JPackageCommand cmd1 = | ||
| JPackageCommand.helloAppImage("com.other/com.other.Hello") | ||
| .useToolProvider(true) | ||
| .setPackageType(PackageType.getDefault()) |
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.
.removeArgumentWithValue("--type") can be used to make jpackage create default native package. This will eliminate need to introduce packageType.getDefault() method.
However, I'd rather replace JPackageCommand with PackageTest in this test scenario. Something like this:
final PackageTest cmd1 = new PackageTest()
.configureHelloApp()
.addInitializer(cmd -> {
cmd.setArgumentValue("--name", "ConcurrentOtherInstaller");
});
cmd1.run(PackageTest.Action.CREATE); would result in a package creation but will no unpack or install will be attempted.
PackageTest is better as it will run tests on created package making sure it is valid.
|
I'd propose to update the test to run more that two concurrent instance of jpackage command. |
| + times[0] + " and times[1] is" + times[1]); | ||
|
|
||
| cmd1.useToolProvider(false); | ||
| cmd1.useToolProvider(false); |
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.
Shouldn't this be cmd2?
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.
I'd parametrize the test function with useToolProvider parameter. This will help to avoid copy/paste of TKit.assertTrue(times...)
I don't think we can be sure of thread-safe behavior of the third party tools, the best thing we can do is thoroughly test (as requested below, run a lot more instances simultaneously). Main thing we are implementing and testing is that jpackage code itself is thread safe. |
yes - I'm planning for a lot more in next revision, your suggestion to use only PackageTest.Action.CREATE will go a long way to making that possible, but I have had problems with test infrastructure fixing the workDir based on test class and method, and then getting IOExceptions as various PackageTest's try to write the same content to the same work dir. I need to create infrastructure to allow each PackageTest to operate on separate workDir. |
|
Reverting this PR to DRAFT while the above suggestions are implemented. |
The above will cause an exception from JPackageCommand.execute() > ... > JPackageCommand.verifyIsOfType(), but perhaps that problem will go away if only JPackageTest.run(PackageTest.Action.CREATE) is used. |
I don't think we need changes to test infrastructure to run PackageTest instances concurrently. This is how to create input for jpackage: This is the function to initialize PackegTest instance that will use hello.jar initialized above to build a package and write output in unique directory inside of test work directory: Glue it all together: |
Remove all non final static variables in jpackage java code (using InheritableThreadLocal for Logger and Argument instances) and remove sychronization in JPackageToolProvider.
Progress
Issue
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1829/head:pull/1829$ git checkout pull/1829