-
Bug
-
Resolution: Duplicate
-
Critical
-
Pipeline Shared Groovy Libraries Plugin - 2.2 (=latest)
If I have a global lib file vars/config.groovy like this:
def getFoo() { return this.foo } def setFoo(String value) { if (this.foo == null) { this.foo = value } else { logImmutableWarning('foo', this.foo, value) } }
and I call
echo config.foo
my Jenkins master hangs with 100% CPU.
If I call
config.foo = 'bar'
echo config.foo
it works fine.
Note that it's impossible to kill the job properly and that CPU is still 100% and a thread is still available even after klicking links in build log.
Aborted by N N Click here to forcibly terminate running steps Click here to forcibly kill entire build
Only way I know to fix this is to restart master.
I do not think the extra setter logic is responsible for this.
I updated this issue because the problem was bigger than I understood at first.
Original issue
Reading global variable in own file cause stack overflow
In have a file in the pipeline global functions (vars/) that has properties. I want to have a default value. But this implementation:
def getSomething() { return this.something ?: 'somethingDefaultValue' }
leads to Jenkins master taking 100% CPU and hanging in what I believe is a stack overflow error. But it's very hard to get any info from logs or thread dumps.
Trying to fix this followng the standard groovy way and adding:
String something
does not help.
- duplicates
-
JENKINS-31484 Endless loop in DefaultInvoker.getProperty when accessing field via getter/setter without @
- Resolved
- relates to
-
JENKINS-34416 Documentation should clarify distinction between global variable access vs. plain class references
- Resolved
-
JENKINS-45834 Setters for shared pipeline scripts not getting called
- Open
- links to