Skip to content

Conversation

gwenneg
Copy link
Member

@gwenneg gwenneg commented Dec 10, 2019

Fixes #6089

@gwenneg
Copy link
Member Author

gwenneg commented Dec 10, 2019

This fixes the NullPointerException and allows the integration tests to end successfully.

@stuartwdouglas Does this look like a reasonable fix? I'm not really in my field of expertise here so I might be doing something totally wrong.

@stuartwdouglas
Copy link
Collaborator

This looks reasonable but you should file a GraalVM issue so it can be fixed upstream.

@gwenneg
Copy link
Member Author

gwenneg commented Dec 10, 2019

Sure, I'll do it. Thanks for having a look!

@gwenneg gwenneg marked this pull request as ready for review December 10, 2019 22:34
@gwenneg gwenneg added the env/graalvm-java11 Relating to using GraalVM native image generation on Java 11 label Dec 10, 2019
@gwenneg
Copy link
Member Author

gwenneg commented Dec 10, 2019

GraalVM issue created: oracle/graal#1966

@gwenneg
Copy link
Member Author

gwenneg commented Dec 10, 2019

@gsmet This might be the solution to all the JDK 11 native integration tests that failed to start recently. It had definitely nothing to do with the time the native image needed to start :)

@gwenneg gwenneg added this to the 1.2.0 milestone Dec 10, 2019
@jaikiran
Copy link
Member

Hello @gwenneg, I just commented on that graal issue you opened. The graal team has fixed it in master branch some days back as part of oracle/graal@68027de.

I think we will need this workaround in Quarkus until 19.3.x is released with that fix. Their commit is different from what is being proposed in this PR - they return true instead of false for hasClassPath. I think we should just copy over their change in that graal commit into Quarkus as a substitution to be consistent with their semantics.

@gwenneg
Copy link
Member Author

gwenneg commented Dec 11, 2019

I don't think we can copy the entire Target_jdk_internal_loader_BootLoader class as we would have to import the ClassForNameSupport class in Quarkus and it is an internal class which is not exported in the svm-19.3.0.jar module-info. But I agree we should at least return the same true value than the GraalVM substitution from oracle/graal@68027de.

@gwenneg
Copy link
Member Author

gwenneg commented Dec 11, 2019

Actually, changing the returned value from false to true in our substitution could also cause the other BootLoader methods to be called (the ones that were substituted in oracle/graal@68027de). I'll need to run an entire Quarkus native build to check if everything's OK with such a change.

@jaikiran
Copy link
Member

I don't think we can copy the entire Target_jdk_internal_loader_BootLoader class as we would have to import the ClassForNameSupport class in Quarkus and it is an internal class which is not exported in the svm-19.3.0.jar module-info

Hello @gwenneg, sorry, I wasn't clear. I actually meant, we should just copy over those 5 new Substitute methods (which don't require any internal class usage) to the BootLoader that were added as part of that commit in graal.

@gwenneg
Copy link
Member Author

gwenneg commented Dec 11, 2019

Oh, I misunderstood you first comment (which was clear enough), sorry :) That will work and I'll do it right now.

@gwenneg gwenneg force-pushed the graalvm-jdk11-bootloader-nullpointerexception branch 2 times, most recently from fc81691 to 3d1e4de Compare December 11, 2019 13:23
@gwenneg
Copy link
Member Author

gwenneg commented Dec 11, 2019

This PR needs to be tested with a full JDK 11 native build.

PLEASE DON'T MERGE before I say it's OK.

@gwenneg
Copy link
Member Author

gwenneg commented Dec 11, 2019

Thanks for your help with this @jaikiran!

@gsmet gsmet changed the title Substitute BootLoader.hasClassPath() to work around a JDK 11 NPE WIP Substitute BootLoader.hasClassPath() to work around a JDK 11 NPE Dec 11, 2019
@gwenneg
Copy link
Member Author

gwenneg commented Dec 12, 2019

I've successfully tested the latest version of this PR with many JDK 11 native integration tests. I think it can be safely merged into master after being reviewed again.

@gwenneg gwenneg changed the title WIP Substitute BootLoader.hasClassPath() to work around a JDK 11 NPE Substitute BootLoader.hasClassPath() to work around a JDK 11 NPE Dec 12, 2019
@gwenneg gwenneg requested a review from gsmet December 12, 2019 00:12
@gwenneg
Copy link
Member Author

gwenneg commented Dec 12, 2019

I just saw a similar NPE that may be related, I'm putting the PR back to WIP to investigate what's going on.

@gwenneg gwenneg changed the title Substitute BootLoader.hasClassPath() to work around a JDK 11 NPE WIP Substitute BootLoader.hasClassPath() to work around a JDK 11 NPE Dec 12, 2019
@gwenneg gwenneg force-pushed the graalvm-jdk11-bootloader-nullpointerexception branch from 5939fae to 90f175c Compare December 12, 2019 01:13
@gwenneg gwenneg changed the title WIP Substitute BootLoader.hasClassPath() to work around a JDK 11 NPE Substitute BootLoader.hasClassPath() to work around a JDK 11 NPE Dec 12, 2019
@gwenneg
Copy link
Member Author

gwenneg commented Dec 12, 2019

I created #6127 to fix the similar NPE mentioned above. Both share a common root cause but require different and independent substitutions to be fixed. I think merging this PR ASAP is important because it might help us detect new issues during native tests execution, that's why I didn't treat #6127 in the same PR.

@gsmet: We're ready for a final review and merge, for real this time.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

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

Nice work, @gwenneg .

@gsmet gsmet merged commit a99e92c into quarkusio:master Dec 12, 2019
@gwenneg gwenneg deleted the graalvm-jdk11-bootloader-nullpointerexception branch December 12, 2019 12:34
@gsmet gsmet removed the backport? label Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

env/graalvm-java11 Relating to using GraalVM native image generation on Java 11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BootLoader.hasClassPath() NPE during native image execution with JDK 11

5 participants