eo
eo copied to clipboard
makes-deep-object-recursively crashes JVM
this test exhausts all heap and crashes jvm
https://github.com/cqfn/eo/runs/4616635006?check_suite_focus=true
Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
Java heap space
java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Arrays.copyOf(Arrays.java:3537)
at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228)
at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:682)
at java.base/java.lang.StringBuilder.append(StringBuilder.java:214)
at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:999)
at java.base/java.util.regex.Matcher.replaceAll(Matcher.java:1181)
at org.eolang.Indented.toString(Indented.java:59)
at java.base/java.util.Formatter$FormatSpecifier.printString(Formatter.java:3056)
at java.base/java.util.Formatter$FormatSpecifier.print(Formatter.java:2933)
at java.base/java.util.Formatter.format(Formatter.java:2689)
at java.base/java.util.Formatter.format(Formatter.java:2625)
at java.base/java.lang.String.format(String.java:4140)
at org.eolang.PhDefault.φTerm(PhDefault.java:144)
at org.eolang.PhNamed.φTerm(PhNamed.java:72)
at org.eolang.Dataized.take(Dataized.java:96)
at org.eolang.Param.weak(Param.java:90)
at org.eolang.Param.strong(Param.java:69)
at EOorg.EOeolang.EObool$EOnot.lambda$new$0(EObool$EOnot.java:45)
at EOorg.EOeolang.EObool$EOnot$$Lambda$481/0x0000000800d2f178.get(Unknown Source)
at org.eolang.AtComposite.get(AtComposite.java:73)
at org.eolang.PhDefault$$Lambda$329/0x0000000800cdbcf0.get(Unknown Source)
at org.eolang.CachedPhi.get(CachedPhi.java:81)
at org.eolang.PhDefault.attr(PhDefault.java:226)
at org.eolang.PhNamed.attr(PhNamed.java:92)
at org.eolang.PhOnce.attr(PhOnce.java:96)
at org.eolang.PhMethod.lambda$new$0(PhMethod.java:42)
at org.eolang.PhMethod$$Lambda$324/0x0000000800cda940.take(Unknown Source)
at org.eolang.Data$Once.take(Data.java:95)
at org.eolang.PhOnce.copy(PhOnce.java:81)
at org.eolang.PhCopy$$Lambda$330/0x0000000800cdc170.take(Unknown Source)
at org.eolang.Data$Once.take(Data.java:95)
at org.eolang.PhOnce.attr(PhOnce.java:91)
@andreoss please, fix it if you can
@yegor256 phi-term strings are getting too large and consume entire heap, there is a lot of redundant information being produced from φTerm method. Should it be really there? For example, the entire list of attributes will be put in such string multiple times.
The possible solution is to add a special type for the return value of φTerm which will eventually produce String, but will not create tons of strings in advance.
@andreoss I think this only happens when we have endless recursion of objects. The φTerm of PhDefault is designed to detect such recursion, but maybe the detection mechanism doesn't work?
@yegor256 @andreoss I believe it is done in #1279 and #931
@andreoss I'm closing. If you have similar problems in the future, please submit a new ticket