Skip to content
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

Java 9 long classpath support to enable deterministic class loading order #3280

Merged
merged 9 commits into from
Jun 8, 2021

Conversation

chanseokoh
Copy link
Member

Fixes #1871 (where #2733 and #1907 are duplicates).

Also addresses #2471 (AppCDS), #894, #1640, and #3147.


As discussed in the previous PR (#2866 (comment)) , for Java 9+, we can always achieve explicitly listing all the dependencies by leveraging the argument file support in Java 9+, without the risk that some OS may not be able to handle an exceptionally long command. This mode will be the default for Java 9+ apps.

But ideally, for Java 9+, I think we should really use the @-argument file feature; we can always preserve the classpath order while never hitting the system argument length limit. This is going to be a lot bigger change.

In sum, perhaps

  • Java 9+: always use a @-argument file. (expandClasspathDependencies is irrelevant.)
  • Java <=8: expand or not based on expandClasspathDependencies. Not decisive on if it should be true by default.

With this, we can always preserve the exact dependency loading order defined by the build system. Going forward, the expandClasspathDependencies option will have no effect with Java 9+. OTOH, Java <=8 will have to continue to set expandClasspathDependencies if the user wants to

Notable implementation details

The design has changed from the initial one.

@chanseokoh chanseokoh requested a review from mpeddada1 June 4, 2021 15:39
@google-cla google-cla bot added the cla: yes label Jun 4, 2021
@chanseokoh chanseokoh added this to the v3.1.0 milestone Jun 4, 2021
Copy link
Contributor

@mpeddada1 mpeddada1 left a comment

Choose a reason for hiding this comment

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

Looks good! Only minor comments. We may want to update the issues listed above (or add an entry in the FAQ) with the new workaround once this feature is released.

Copy link
Member Author

@chanseokoh chanseokoh left a comment

Choose a reason for hiding this comment

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

Will merge this today.

@chanseokoh
Copy link
Member Author

Hmm.... actually I think I found an issue with this. Looking into it.

@chanseokoh
Copy link
Member Author

Hmm.... actually I think I found an issue with this. Looking into it.

Nope, false alarm. It was that I wanted to clean up the code a bit last week.

Copy link
Contributor

@mpeddada1 mpeddada1 left a comment

Choose a reason for hiding this comment

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

Took another look. LGTM

@chanseokoh chanseokoh merged commit dde73e0 into master Jun 8, 2021
@chanseokoh chanseokoh deleted the java9-classpath-pr branch June 8, 2021 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jar loading order error causes spring-boot startup to fail
2 participants