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
Ensure that no-isolation workers run with the classloader of the submitting thread #10335
Conversation
…itting thread This fixes a problem where, in a composite build, a worker can get a context classloader set to a classloader from another project, which causes a class mismatch when we attempt to re-hydrate a legacy runnable class in AdapterWorkAction. We now ensure that the context classloader for no-isolation workers get set to the context classloader of the thread that submitted the work.
def "can use worker api with composite builds using #pluginId"() { | ||
settingsFile << """ | ||
includeBuild "plugin" | ||
includeBuild "build1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you use a better name for build1? this looks like it's some kind of empty dependency for the root project. Maybe just "dependency"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough - I've changed the project names to "app" and "lib".
} | ||
|
||
dependencies { | ||
classpath "org.apache.commons:commons-math:2.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary to trigger the breakage? If so, could you put a comment explaining how this is important?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is necessary since classloader caching would cause an identical classpath to be returned for both builds unless there is some difference. However, it's not necessary that it actually be a real dependency. I've changed this to just an un-managed file and eliminated the external dependency.
This fixes a problem where, in a composite build, a worker can get a context
classloader set to a classloader from another project, which causes a class
mismatch when we attempt to re-hydrate a legacy runnable class in AdapterWorkAction.
We now ensure that the context classloader for no-isolation workers get set
to the context classloader of the thread that submitted the work.
Fixes #10317