RFR: 8374219: Fix issues in jpackage's Executor class [v4]
Alexey Semenyuk
asemenyuk at openjdk.org
Fri Jan 9 03:49:38 UTC 2026
On Fri, 9 Jan 2026 03:42:28 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:
>> - Move code shared between jpackage's Executor and jpackage's test lib Executor into `jdk.jpackage.internal.util.CommandOutputControl` class using the latter one as the baseline for the new class; [CommandOutputControl class javadoc](https://alexeysemenyukoracle.github.io/jpackage-javadoc/jdk.jpackage/jdk/jpackage/internal/util/CommandOutputControl.html).
>> - Place "execute with retries" logic into `jdk.jpackage.internal.util.RetryExecutor` class and use it from both jpackage and jpackage's test lib. Use `jdk.jpackage.internal.RetryExecutor` class as the baseline.
>> - Add `ObjectFactory`, `ExecutorFactory`, and `RetryExecutorFactory` interfaces to the "jdk.jpackage.internal" package. They enable the use of command mocks with jpackage.
>> - Add `jdk.jpackage.test.mock` package. It facilitates creating command mocks. Use it to test LibProvidersLookup, LinuxSystemEnvironment, LinuxPackageArch, MacDmgSystemEnvironment, and MacDmgPackager classes.
>>
>> Supplementary changes:
>> - Make `jdk.jpackage.internal.SystemEnvironment` and all implementing classes package private
>
> Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision:
>
> Rework JPackageCommand#withToolProvider() to run workload in a new native thread instead of a virtual thread from a pool. Pooled and/or virtual threads are problematic when used with inheritable thread-local variables. TKit class depends on such a variable, which results in intermittent test failure:
>
> java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "jdk.jpackage.test.TestInstance.workDir()" because the return value of "jdk.jpackage.test.TKit.currentTest()" is null
> at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:323)
> at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:359)
> at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:364)
> at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1828)
> at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1817)
> at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
> at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1436)
> at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2011)
> at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
> Caused by: java.lang.NullPointerException: Cannot invoke "jdk.jpackage.test.TestInstance.workDir()" because the return value of "jdk.jpackage.test.TKit.currentTest()" is null
> at jdk.jpackage.test.TKit.workDir(TKit.java:244)
> at jdk.jpackage.test.JPackageCommand.setDefaultInputOutput(JPackageCommand.java:280)
> at jdk.jpackage.test.JPackageCommand.helloAppImage(JPackageCommand.java:384)
> at jdk.jpackage.test.JPackageCommand.helloAppImage(JPackageCommand.java:361)
> at jdk.jpackage/jdk.jpackage.internal.cli.MainTest.lambda$testFailedCommandOutput$2(MainTest.java:123)
> at jdk.jpackage.test.JPackageCommand.lambda$withToolProvider$0(JPackageCommand.java:805)
> at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1825)
> ... 5 more
Updated the review with a fix for the new `JPackageCommand.withToolProvider()`. The fix comes from the project based on this patch that revealed the issue.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28733#issuecomment-3726967171
More information about the core-libs-dev
mailing list