Skip to content

IllegalStateException when command executed by jpackage "Executor" timeouts#31032

Open
sashamatveev wants to merge 1 commit intoopenjdk:masterfrom
sashamatveev:JDK-8383821
Open

IllegalStateException when command executed by jpackage "Executor" timeouts#31032
sashamatveev wants to merge 1 commit intoopenjdk:masterfrom
sashamatveev:JDK-8383821

Conversation

@sashamatveev
Copy link
Copy Markdown
Member

@sashamatveev sashamatveev commented May 5, 2026

  • Fixed by introducing UnavailableExitCodeException which will be thrown when command timeouts to signal that exit code is not available.
  • Added test coverage for UnavailableExitCodeException.
  • CodesignException and retryUntilExitCodeIs adjusted for new exception.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31032/head:pull/31032
$ git checkout pull/31032

Update a local copy of the PR:
$ git checkout pull/31032
$ git pull https://git.openjdk.org/jdk.git pull/31032/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 31032

View PR using the GUI difftool:
$ git pr show -t 31032

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31032.diff

@sashamatveev
Copy link
Copy Markdown
Member Author

@alexeysemenyukoracle Please review.

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented May 5, 2026

👋 Welcome back almatvee! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 5, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot added the core-libs core-libs-dev@openjdk.org label May 5, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 5, 2026

@sashamatveev The following label will be automatically applied to this pull request:

  • core-libs

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.

Comment on lines +354 to +360
// Verify UnavailableExitCodeException
var expectExitCodeEx = assertThrowsExactly(UnavailableExitCodeException.class, () -> {
result.expectExitCode(0);
});
assertEquals(String.format("Exit code unavailable from executing the command %s",
result.execAttrs().printableCommandLine()), expectExitCodeEx.getMessage());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is good to have this supplementary check.

However, we need a dedicated unit test that covers the behavior of Result.expectExitCode() when the Result instance doesn't have an exit code. You can model one from test_Result_expectExitCode() and test_Result_expectExitCode_negative() unit tests.

throw uecex; // Pass to exception mapper
}
// Pass exception to caller
throw ExceptionBox.toUnchecked(ex);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Pass exception to caller comment is misleading because control flow can't reach throw ExceptionBox.toUnchecked(ex) expression because the Executor class doesn't execute commands with timeouts.

I'd replace it with:

// Unreachable, because the result must always have the exit code, as the executor never runs commands with a timeout.
throw ExceptionBox.reachedUnreachable();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

2 participants