-
Notifications
You must be signed in to change notification settings - Fork 194
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
Making sure ArgumentsAction is attached in time for GraphListener.Synchronous notification #254
Conversation
A FlowNode was being sent to GraphListener.Synchronous without ArgumentsAction available. (cherry picked from commit e8953b5)
For those who will be equally confused about the key missing piece: this depends on the upstream PR because we need to be able to get the Environment a bit early (before we have the FlowNode set up and everything). |
Note that the entire reason |
final CpsStepContext context = new CpsStepContext(d,thread,handle,an,ps.body); | ||
// Ensure ArgumentsAction is attached before we notify even synchronous listeners: | ||
final CpsStepContext context = new CpsStepContext(d, thread, handle, an, ps.body); | ||
try { |
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.
I think that you want the classloader switch to happen before the try block for safety, no? Or is there a reason why we shouldn't continue running this logic under the CpsVmExecutorService.ORIGINAL_CONTEXT_CLASS_LOADER.get()
anymore?
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 never needed to be run with a special CCL to begin with. That is just where you happened to drop that new code. The CCL is for user code, mainly StepExecution.start
implementations.
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.
The ORIGINAL_CONTEXT_CLASSLOADER
is for non-Groovy code though IIRC -- and IIRC we are switching away from the GroovyClassLoader to avoid stuff being loaded there (and potential memory leaks or issues with classloaders not matching).
I think you still want this to be happening with the non-Groovy classloader.
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.
The
ORIGINAL_CONTEXT_CLASSLOADER
is for non-Groovy code though
For non-Groovy plugin code, yes.
we are switching away from the GroovyClassLoader to avoid stuff being loaded there (and potential memory leaks or issues with classloaders not matching)
We are switching to the CCL used for general plugin Java code while we run the general plugin Java code: StepDescriptor.newInstance
, Step.start
, and (especially) StepExecution.start
. ArgumentsActionImpl
has nothing to do with this.
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.
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.
The contextClassLoader change makes me twitchy, but I can't see an obvious bug.
Downstream of jenkinsci/workflow-support-plugin#75. Extracted from #252 as an independently releasable fix necessary to avoid regressing
StepNodeTest
(specifically, proper display of metasteps in the classic UI console) after changes in JEP-210. Specifically, as of jenkinsci/workflow-job-plugin#27 (comment)FlowNode.getDisplayFunctionName
is called from within a synchronous listener. (Formerly this was an asynchronous listener, which sounds wrong but then againcopyLogs
was asynchronous too so who cared?) And this method call pays attention toArgumentsAction
to display, for example,archiveArtifacts
rather thanstep
(the generic function name ofCoreStep
). So we need to ensure that at least this basic metadata about theFlowNode
is actually present by the time listeners are told about it. Some other metadata gets added later, likeLabelAction
, but we tolerate that—the new console UI renders the label via aConsoleNote
, potentially much later, at which point the label is known.