Update July 31, 2019
The error sometimes happens before the unstash call, but always on the same server. In an effort to see if the problem was caused by unstash working in a directory where it needed to overwrite files, I cleaned the directory -- but the problem still happened. This time the output began (transcribed, any typos are my fault):
Running on my_agent in C:/Jenkins/workspace/script_name
. . .
Running in D:\mydir
[Pipeline] {
[Pipeline] bat
[mydir] Running batch script
D:\mydir> dir .
<output of dir command>
[Pipeline] End of Pipeline
java.lang.StackOverflowError
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:115)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:778)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
etc.
It did not reach the unstash call, but still got the same error.
= = = = =
Getting java.lang.StackOverflowError when unstashing in Jenkins on Windows 10; happens on one server but not another. Looks like unstash is getting infinite recursion.
def stash_my_stuff() {
stash includes: '**', name: 'my_stash'
}
def unstash_my_stuff() {
unstash 'my_stash'
}
// on one agent
dir("d:\\tmsc") { unstash_my_stuff() }
// later on a different agent
dir("d:\\tmsc") { unstash_my_stuff() }
13:23:33 Running in D:\tmsc
[Pipeline] {
[Pipeline] unstash
[Pipeline] }
[Pipeline] // dir
[Pipeline] dir
13:24:01 Running in D:\tmsc
[Pipeline] {
[Pipeline] End of Pipeline
java.lang.StackOverflowError
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:111)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:778)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
etc., etc., etc.
sometimes it also includes
at org.jboss.marshalling.river.RiverMarshaller.doSerializableObject(RiverMarshaller.java:967)
The java.lang.StackOverflowError is a runtime error which points to serious problems that cannot be caught by an application. The java.lang.StackOverflowError indicates that the application stack is exhausted and is usually caused by deep or infinite recursion. What Causes java.lang.StackOverflowError in Java
A stack overflow can result from: Applications requiring a larger stack size, especially ones relying on XML, GUI, or java2D classes. Stack overflow issues are frequently masked by Out of Memory exceptions.
For every Java thread, there are two stacks that are utilized. One is for Java code for method calls, and the other is for native C code (on Solaris and HP-UX, only the native stack is utilized). These are adjustable and can be raised to provide more room on the stacks to prevent an overflow.
Stack Overflow exceptions can occur when a thread stack continues to grow in size until reaching the maximum limit. A stack overflow can result from: Applications requiring a larger stack size, especially ones relying on XML, GUI, or java2D classes. Stack overflow issues are frequently masked by Out of Memory exceptions.
I ran into a similar error and was able to ultimately resolve it by a couple things, one of which MarekR mentioned in his answer.
Finally be sure to save the xml file and restart the jenkins service to pick up the new changes.
Hope this helps!
I've encounter similar problem when using parallel stages.
I've found bug report about that. One of the comment (which is praised by next comment) recommends this:
I encountered this issue too. I am using Jenkins on Windows which was installed using the installer. After some digging, I realized that this distribution of Jenkins comes packaged with a 32-bit version of the JRE, and it is used by the Windows Service (which uses the jenkins.xml file). This severely limits the amount of heap memory the JVM can allocate. If you're facing this issue in the same situation, modify jenkins.xml to use a different, 64-bit version of JRE and also increase the max heap allocation (e.g. -Xmx1024m).
I didn't try that yet (I do not have proper access right to servers with Jenkins), but when I do it I will update the answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With