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

Don't delegate to parent CL for "leaking" dependencies from build system #4905

Closed
wants to merge 1 commit into from

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Oct 27, 2019

Fixes: #4767

Would be great to have #4579 in so some new integration tests could be added with known problematic cases.

The problem is caused because the parent CL (defined here) contains all the classes of the build system.
This solution is pretty bad and should be temporary until a proper solution
like #770 is implemented.

This solution is pretty bad and should be temporary until a proper solution
like quarkusio#770 is implemented
@maxandersen
Copy link
Member

As discussed at https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/gradle/near/179211143 my hunch is that this is better fixed by actually using an isolated classloader rather than use our own custom one hooked up to gradle.

Gradle's worker api allows you to control it - see https://guides.gradle.org/using-the-worker-api/#changing_the_isolation_mode

culprit is at https://github.com/quarkusio/quarkus/blob/master/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentTask.java#L162 and that code looks (on first look) ripe for using Worker API to separate our quarkus work from gradle work.

@geoand
Copy link
Contributor Author

geoand commented Oct 28, 2019

@maxandersen makes sense. However I am not sure we can get that done in the short term

// The solution is pretty bad and should be views as temporary until a proper solution
// (like the one proposed here: https://github.com/quarkusio/quarkus/issues/770)
if (lookup) {
Class<?> loadedClass = findLoadedClass(name);
Copy link
Member

Choose a reason for hiding this comment

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

I think this might be problematic. What is Gradle has already loaded some classes from guava? findLoadedClass will return the one loaded by the base class loader, but any classes that have not been loaded yet will be loaded by this class loader, breaking any package protected access and loading different versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am assuming that would only happen if some plugin used in the build depended on Guava and was unshaded. It could probably happen, but I am assuming it won't be very likely.

Copy link
Member

Choose a reason for hiding this comment

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

Why would it be in the build classpath if it is not being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Guava sneaks in (or at least used to sneak in) because it was a dependency of the maven resolver, or some other library we use in boostrap.

@stuartwdouglas
Copy link
Member

I am going to try and find the time to come up with a better solution for this today.

@stuartwdouglas
Copy link
Member

I think this approach might be better for now: #5013

@stuartwdouglas
Copy link
Member

So class loader isolation won't really help here, as the underlying issue is that gradle does not seem to differentiate between user dependencies and plugin dependencies (at least as far as I can tell, there may be an API to do this that I am not aware of, alternatively it may be related to how we structure our build files).

Class loader isolation does not help when we can't determine which artifacts are actual runtime artifacts that the user wants, vs artifacts brought in by plugins.

@geoand
Copy link
Contributor Author

geoand commented Oct 30, 2019

I'll keep this around in draft for just reference sake and close it when we have a proper classloader system in place.

@geoand geoand added the triage/on-ice Frozen until external concerns are resolved label Oct 30, 2019
@geoand
Copy link
Contributor Author

geoand commented Nov 12, 2019

Closing since we probably won't do this

@maxandersen
Copy link
Member

@gsmet why did you mark this as invalid ?

@maxandersen maxandersen reopened this Dec 16, 2019
@maxandersen
Copy link
Member

reopening it since at it is worth exploring if we can't get stop gradle plugins from mingling with user dependencies or at least verify that this and related issues are all gone now.

@maxandersen
Copy link
Member

gah- stupid github, wrong PR/issue. closing ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/invalid This doesn't seem right triage/on-ice Frozen until external concerns are resolved triage/requires-stuart
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java 11/Gradle - NullPointerException on build Reactive Messaging
4 participants