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

[GR-40187] Dectect invalid use of SVM specific classes on image class- or module-path. #5232

Merged
merged 10 commits into from
Oct 18, 2022

Conversation

graalvmbot
Copy link
Collaborator

@graalvmbot graalvmbot commented Oct 17, 2022

Sometimes projects falsely depend on svm.jar (or graal-sdk.jar) or transitively include svm classes in uber-jars. This also happens e.g. when a Maven projects depends on svm.jar but does not specify it as a dependency of type provided.

To better detect such misuse and to allow users to better understand what is wrong we make our com.oracle.svm.hosted.NativeImageSystemClassLoader able to detect such cases.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 17, 2022
@olpaw
Copy link
Member

olpaw commented Oct 17, 2022

@zakkak this PR will likely require changes on the quarkus side. We have identified quarkus examples that contain launcher jar files that put a graal-sdk on the classpath. This is why we have added workaround 7f83c75 in here. It runs those quarkus examples with -H:+TolerateBuilderClassesOnImageClasspath to make the builder tolerant towards having parts of the builder also on the image classpath. The correct fix though is to make sure quarkus does not create launchers that have graal-sdk on the classpath.

For example the tika-wrk benchmark that we download from https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/tika-1.0.8.zip
embeds org.graalvm.sdk.graal-sdk-21.3.1.jar and puts it on the classpath via its MANIFEST.MF ClassPath: in tika-quickstart-1.0.8-runner.jar. This needs to be removed.

There must not be a graal-sdk.jar (or the classes contained in it) in the ClassPath: entries of the MANIFEST.MF of such launchers. Let me know if you want me to create a quarkus github issue for that.

@zakkak
Copy link
Collaborator

zakkak commented Oct 17, 2022

Thanks for the heads up @olpaw. I started a CI run with this branch to see how many of the integration tests it affects.

zakkak added a commit to zakkak/quarkus that referenced this pull request Oct 18, 2022
@zakkak
Copy link
Collaborator

zakkak commented Oct 18, 2022

@olpaw quarkusio/quarkus#28650 seems to do the trick for Quarkus.
It avoids adding svm.jar and graal-sdk.jar to the classpath for native builds.

Thanks again for the heads up.

zakkak added a commit to zakkak/quarkus that referenced this pull request Oct 18, 2022
zakkak added a commit to zakkak/quarkus that referenced this pull request Oct 18, 2022
zakkak added a commit to zakkak/quarkus that referenced this pull request Oct 18, 2022
@olpaw
Copy link
Member

olpaw commented Oct 18, 2022

It avoids adding svm.jar and graal-sdk.jar to the classpath for native builds.

💯 Thanks a lot!

@graalvmbot graalvmbot merged commit 90c1f56 into master Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants