Error java.lang.StackOverflowError

0 votes
asked Mar 9, 2016 in Bug by anonymous
edited Mar 9, 2016

Hi,

Below is an example.

@startuml
note over Locus,Cassandra: [[{3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n 3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n}]]test it
@enduml

When I try to run it to get a sequence diagram programmatically, I got the following error messages:

Error java.lang.StackOverflowError
java.lang.StackOverflowError
    at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4785)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4568)

...

    at java.util.regex.Pattern$Loop.match(Pattern.java:4785)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
You should send a mail to plantuml@gmail.com with this log (V8036)

Is there any limit on the tooltip message size?

My plantuml version is 8036.

Thanks,

 

1 Answer

0 votes
answered Mar 14, 2016 by plantuml (294,960 points)
Thanks for the report.

However, are you sure about the version you are using ?
There may be some limitations, but your example seems to work on the online server:

http://plantuml.com/plantuml/svg/xSun3i9030J0h-m3A11qb211mmz2YbFY71OdMpexWO3uEnSUWIYkNUskHjG9Eb76MRlHLeTW5gJFOOUcUMtXLvPes7DAE0Kd-oOtGwTZwf5fqZGwg_2Ja7WWi9GAGUZXsAmnKyXs4HmvcuCDGK12ESwbAJg5PGnN9BqNnJBjj3GB0f4ScNleW9Y9vAgZ4M8mMXx_6LTjrLPjrLPjlxUzsxPmogL_0000

Could you double check your example and the version you are using ?
Thanks
commented Mar 15, 2016 by anonymous
I am sure the plantuml version is 8036.
commented Mar 17, 2016 by anonymous
any thoughts?
commented Mar 17, 2016 by plantuml (294,960 points)
It may be related to your java version.
Could you try:
@startuml
version
@enduml
and post or send us the result image ?
Thanks
commented Mar 17, 2016 by anonymous
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
commented Mar 17, 2016 by plantuml (294,960 points)
Could you post the actual image ? There are more information there. Thanks.
commented Mar 18, 2016 by anonymous
Below is the source code.

    private static void convertText2Svg() throws Exception {

        FileReader fileReader = new FileReader("diagnostics/output/test3.txt");
        BufferedReader br = new BufferedReader(fileReader);
        String line = null;
        StringBuffer sb = new StringBuffer();
        while ((line = br.readLine()) != null) {
            sb.append(line).append("\n");
        }
        br.close();
        fileReader.close();

        SourceStringReader reader = new SourceStringReader(sb.toString());
        final ByteArrayOutputStream os = new ByteArrayOutputStream();
        String desc = reader.generateImage(os, new FileFormatOption(FileFormat.SVG));
        //logger.info("des = {}", desc);
        os.close();

        // The XML is stored into svg
        final String svg = new String(os.toByteArray());
        //logger.info("svg = {}", svg);
        File out = new File("diagnostics/output/test3.html");
        if (!out.exists()) {
            out.createNewFile();
        }
        FileWriter fw = new FileWriter(out.getAbsoluteFile());
        BufferedWriter bw = new BufferedWriter(fw);

        //bw.write(createHtml(svg));
        bw.write(svg);
        bw.flush();
        bw.close();
    }

test3.txt is:
@startuml
note over Locus,Cassandra: [[{3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n 3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n3 things Bill Gates thinks could revolutionize life in the next 20 years\n First is an energy innovation to lower the cost and get rid of greenhouse gases\n}]]test it
@enduml
commented Mar 22, 2016 by anonymous
please let know if the exception is repeatable for you.
commented Mar 22, 2016 by plantuml (294,960 points)
Thanks for your code. But unfortunalty no, the exception is not repeatable.
Your code produces the following file, which looks fine https://dl.dropboxusercontent.com/u/13064071/test3.html

Our JVM is jre1.8.0_31 under Windows 8.1

The stacktrace looks like an issue on the Regex Engine.
But I doubt that they are major change here between java version 1.8.0_74 and 1.8.0_31.

Under which OS are you running ?
commented Mar 22, 2016 by plantuml (294,960 points)
We've build a special version https://dl.dropboxusercontent.com/u/13064071/plantuml.jar that prints all used Regex.
Is it possible that you run your example with this .jar, and then give us the result ?
It would help to understand what's going on.
Thanks
commented Mar 23, 2016 by anonymous
My OS is OS X 10.10.5
commented Mar 23, 2016 by anonymous
I'll try to test the new jar and let you know the result.
Thanks
commented Mar 23, 2016 by anonymous
I just tested your new plantuml.jar. It looks like the result is the same as before.

PATTERN=(?i)^caption(?:[\s ]*:[\s ]*|[\s ]+)(.*[\p{L}0-9_.].*)$
PATTERN=(?i)^(?:(left|right|center)?[\s ]*)footer(?:[\s ]*:[\s ]*|[\s ]+)(.*[\p{L}0-9_.].*)$
PATTERN=(?i)^(?:(left|right|center)?[\s ]*)header(?:[\s ]*:[\s ]*|[\s ]+)(.*[\p{L}0-9_.].*)$
PATTERN=(?i)^(skinparam|skinparamlocked)[\s ]+([\w.]*(?:\<\<.*\>\>)?[\w.]*)[\s ]+([^{}]*)$
PATTERN=(?i)^minwidth[\s ]+(\d+)$
PATTERN=(?i)^rotate$
PATTERN=(?i)^scale[\s ]+([0-9.]+)(?:[\s ]*/[\s ]*([0-9.]+))?$
PATTERN=(?i)^scale[\s ]+([0-9.]+)[\s ]*[*x][\s ]*([0-9.]+)$
PATTERN=(?i)^scale[\s ]+([0-9.]+)[\s ]+(width|height)$
PATTERN=(?i)^scale[\s ]+max[\s ]+([0-9.]+)[\s ]+width$
PATTERN=(?i)^scale[\s ]+max[\s ]+([0-9.]+)[\s ]+height$
PATTERN=(?i)^scale[\s ]+max[\s ]+([0-9.]+)[\s ]*[*x][\s ]*([0-9.]+)$
PATTERN=(?i)^!transformation[\s ]+([^{}]*)$
PATTERN=(?i)^(hide|show)[\s ]+unlinked$
PATTERN=RegexConcat ^sprite[\s ]+\$?([\p{L}0-9_]+)[\s ]*(?:\[(\d+)x(\d+)/(\d+)(z)\])?[\s ]+([-_A-Za-z0-9]+)$
PATTERN=RegexConcat ^sprite[\s ]+\$?([\p{L}0-9_]+)[\s ]*[\s ]+(.*)$
PATTERN=RegexConcat ^(hide|show)[\s ]+((?:public|private|protected|package)?(?:[,\s ]+(?:public|private|protected|package))*)[\s ]+(members?|attributes?|fields?|methods?)$
PATTERN=RegexConcat ^(hide|show)[\s ]+(?:(class|interface|enum|annotation|abstract|[\p{L}0-9_.]+|["“”«»][^"“”«»]+["“”«»]|\<\<.*\>\>)[\s ]+)*?(?:(empty)[\s ]+)?(members?|attributes?|fields?|methods?|circle\w*|stereotypes?)$
PATTERN=RegexConcat ^post[-[\s ]]?it[\s ]+([-\p{L}0-9_./]+)[\s ]+:?(.*)?$
PATTERN=(?i)^width[\s ]+(\d+)$
PATTERN=(?i)^[\s ]*$
PATTERN=(?i)^[\s ]*(['‘’].*||/['‘’].*['‘’]/[\s ]*)$
PATTERN=(?i)^!pragma[\s ]+([A-Za-z_][A-Za-z_0-9]*)(?:[\s ]+(.*))?$
PATTERN=(?i)^title(?:[\s ]*:[\s ]*|[\s ]+)(.*[\p{L}0-9_.].*)$
PATTERN=(?i)^caption(?:[\s ]*:[\s ]*|[\s ]+)(.*[\p{L}0-9_.].*)$
PATTERN=(?i)^(?:(left|right|center)?[\s ]*)footer(?:[\s ]*:[\s ]*|[\s ]+)(.*[\p{L}0-9_.].*)$
PATTERN=(?i)^(?:(left|right|center)?[\s ]*)header(?:[\s ]*:[\s ]*|[\s ]+)(.*[\p{L}0-9_.].*)$
PATTERN=(?i)^(skinparam|skinparamlocked)[\s ]+([\w.]*(?:\<\<.*\>\>)?[\w.]*)[\s ]+([^{}]*)$
PATTERN=(?i)^minwidth[\s ]+(\d+)$
PATTERN=(?i)^rotate$
.....
commented Mar 23, 2016 by plantuml (294,960 points)
I am interested by the very last "PATTERN=" line because it should print the regex that crashes. That would definitively help for debug.
Thanks!
commented Mar 24, 2016 by anonymous
Ok, below are the last PATTER= lines.

PATTERN=(?i)^(skinparam|skinparamlocked)[\s ]+([\w.]*(?:\<\<.*\>\>)?[\w.]*)[\s ]+([^{}]*)$
PATTERN=(?i)^minwidth[\s ]+(\d+)$
PATTERN=(?i)^rotate$
PATTERN=(?i)^scale[\s ]+([0-9.]+)(?:[\s ]*/[\s ]*([0-9.]+))?$
PATTERN=(?i)^scale[\s ]+([0-9.]+)[\s ]*[*x][\s ]*([0-9.]+)$
PATTERN=(?i)^scale[\s ]+([0-9.]+)[\s ]+(width|height)$
PATTERN=(?i)^scale[\s ]+max[\s ]+([0-9.]+)[\s ]+width$
PATTERN=(?i)^scale[\s ]+max[\s ]+([0-9.]+)[\s ]+height$
PATTERN=(?i)^scale[\s ]+max[\s ]+([0-9.]+)[\s ]*[*x][\s ]*([0-9.]+)$
PATTERN=(?i)^!transformation[\s ]+([^{}]*)$
PATTERN=(?i)^(hide|show)[\s ]+unlinked$
PATTERN=RegexConcat ^sprite[\s ]+\$?([\p{L}0-9_]+)[\s ]*(?:\[(\d+)x(\d+)/(\d+)(z)\])?[\s ]+([-_A-Za-z0-9]+)$
PATTERN=RegexConcat ^sprite[\s ]+\$?([\p{L}0-9_]+)[\s ]*[\s ]+(.*)$
PATTERN=RegexConcat ^(hide|show)[\s ]+((?:public|private|protected|package)?(?:[,\s ]+(?:public|private|protected|package))*)[\s ]+(members?|attributes?|fields?|methods?)$
PATTERN=RegexConcat ^(hide|show)[\s ]+(?:(class|interface|enum|annotation|abstract|[\p{L}0-9_.]+|["“”«»][^"“”«»]+["“”«»]|\<\<.*\>\>)[\s ]+)*?(?:(empty)[\s ]+)?(members?|attributes?|fields?|methods?|circle\w*|stereotypes?)$
PATTERN=RegexConcat ^post[-[\s ]]?it[\s ]+([-\p{L}0-9_./]+)[\s ]+:?(.*)?$
PATTERN=(?i)^width[\s ]+(\d+)$

Thanks
commented Mar 25, 2016 by plantuml (294,960 points)
Ok, thanks for the logs.
The problem may have been understood. Difficult to be affirmative.
Here is yet another version that may work with your example https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
Can you tell us the result ?
Note that even if this works, the problem is not completely solved : it would just mean that we have understand it.
Thanks and sorry about this remote debug!
commented Mar 28, 2016 by anonymous
It works with your attached plantuml.jar.
Thanks a lot!
...