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

Getting a stackoverflow error #123

Closed
dineshgioe opened this issue Oct 22, 2018 · 4 comments
Closed

Getting a stackoverflow error #123

dineshgioe opened this issue Oct 22, 2018 · 4 comments

Comments

@dineshgioe
Copy link

dineshgioe commented Oct 22, 2018

I was trying to use this library to test my pipeline code. I have my pipelines defined in a share library and I am calling this library as a pipeline script. Following code is configured as a pipeline code in the jenkin jobs.

**@Library('commons@develop')
import test.builds.designapp.Facade

new Facade(this).createPipeline()**

Facade is a groovy class which contains the required pipeline code. I have tried to test this by copying the same above exact lines into a file and loading the file using loadScript method.

    library = library()
                .name('commons')
                .retriever(gitSource('giturl'))
                .targetPath(commonsPath)
                .defaultVersion("develop")
                .allowOverride(true)
                .implicit(false)
                .build()
    helper.registerSharedLibrary(library)

@Test
void should_execute_on_master() throws Exception {
    try{
        runScript('Jenkinsfile')
    } catch (Exception e){
        println e.getLocalizedMessage()
    }
}

But when I tried to run the tests I am getting the "java.lang.StackOverflowError" with out any trace. I have tried in multiple ways but end up with same error. I would like to know if this is a proper way of using the jenkinspipelineunit.

@stchar
Copy link
Contributor

stchar commented Mar 15, 2019

@dineshgioe
Hi, sorry, It's not clear what is wrong with it.
If it is still actual, could you please submit a testcase to reproduce the issue?

@linehammer
Copy link

A StackOverflowError is simply signals that there is no more memory available. It is to the stack what an OutOfMemoryError is to the heap: it simply signals that there is no more memory available. JVM has a given memory allocated for each stack of each thread, and if an attempt to call a method happens to fill this memory, JVM throws an error. Just like it would do if you were trying to write at index N of an array of length N. No memory corruption can happen. The stack can not write into the heap.

The common cause for a stackoverflow is a bad recursive call. Typically, this is caused when your recursive functions doesn't have the correct termination condition, so it ends up calling itself forever. Or when the termination condition is fine, it can be caused by requiring too many recursive calls before fulfilling it.

Here's an example:

public class Overflow {
    public static final void main(String[] args) {
        main(args);
    }
}

That function calls itself repeatedly with no termination condition. Consequently, the stack fills up because each call has to push a return address on the stack, but the return addresses are never popped off the stack because the function never returns, it just keeps calling itself.

@axieum
Copy link
Contributor

axieum commented Jul 16, 2024

This happens to be related to #585

@nre-ableton
Copy link
Contributor

I think @axieum is right, let's close this issue in favor of #585, since that one has more detail.

@nre-ableton nre-ableton closed this as not planned Won't fix, can't repro, duplicate, stale Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants