My code had an error that resulted in some interesting behaviour:
`
val scn = scenario(“My Scenario”)
.feed(user)
.exec(addCookie(Cookie(“ImportantThing”,"${Thing}")))
.repeat(common.times.toInt, “iter”){
.exec( session => {
session
.set(“URL”, “/MyURLWithSomeFormattingAndJunk”)
.set(“currentID”, session(“IDList”).as[String].split(",")(session(“iter”).as[Int]))
})
.exec(http(“First Call”)
.get("${URL") // <— OOPS!
.headers(headers)
.check(status.is(200), jsonPath("$.Id").is("${currentID}"))
)
.exec(http(“Second Call”)
.get("${URL") // <— Copy and pasted OOPS!
.headers(headers)
.check(status.is(200), jsonPath("$.Id").is("${currentID}"))
)
}
.exec( session => {
val newCookieList = session(“gatling.http.cookies”).as[CookieJar].get(Uri.create(“http://myserver/”))
breakable {
for (cookie ← newCookieList) {
if (cookie.getName().toLowerCase() == “importantthing”) {
updateThing(session(“ID”).as[String],cookie.getValue())
break
}
}
}
session
})
`
Note that I failed to close the curly brace on the session attribute name (twice). When Gatling got to that first “OOPS” line, it fell into an infinite loop and the Gatling java eventually ran out of memory.
This is the offending stack at the time of the error:
main
at java.lang.OutOfMemoryError.<init>()V (OutOfMemoryError.java:48)
at java.util.Arrays.copyOf([CI)[C (Arrays.java:2367)
at java.lang.AbstractStringBuilder.expandCapacity(I)V (AbstractStringBuilder.java:130)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(I)V (AbstractStringBuilder.java:114)
at java.lang.AbstractStringBuilder.append(Ljava/lang/String;)Ljava/lang/AbstractStringBuilder; (AbstractStringBuilder.java:415)
at java.lang.StringBuilder.append(Ljava/lang/String;)Ljava/lang/StringBuilder; (StringBuilder.java:132)
at scala.collection.mutable.StringBuilder.append(Ljava/lang/Object;)Lscala/collection/mutable/StringBuilder; (StringBuilder.scala:197)
at scala.util.parsing.combinator.RegexParsers$$anon$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (RegexParsers.scala:98)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$map$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:242)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$map$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:242)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$$anonfun$rep1$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:736)
at scala.util.parsing.combinator.Parsers$$anonfun$rep1$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:721)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$map$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:242)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$map$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:242)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Success.flatMapWithNext(Lscala/Function1;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:142)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$map$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:242)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$map$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:242)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$map$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:242)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$map$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:242)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Success.flatMapWithNext(Lscala/Function1;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:142)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$$anonfun$rep1$1.applyp$1(Lscala/util/parsing/input/Reader;Lscala/collection/mutable/ListBuffer;Lscala/util/parsing/combinator/Parsers$Parser;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:727)
at scala.util.parsing.combinator.Parsers$$anonfun$rep1$1.continue$1(Lscala/util/parsing/input/Reader;Lscala/runtime/ObjectRef;Lscala/collection/mutable/ListBuffer;Lscala/runtime/VolatileByteRef;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:733)
at scala.util.parsing.combinator.Parsers$$anonfun$rep1$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:737)
at scala.util.parsing.combinator.Parsers$$anonfun$rep1$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:721)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$flatMap$1.apply(Ljava/lang/Object;)Ljava/lang/Object; (Parsers.scala:239)
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:222)
at scala.util.parsing.combinator.Parsers$$anon$2$$anonfun$apply$14.apply()Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:891)
at scala.util.parsing.combinator.Parsers$$anon$2$$anonfun$apply$14.apply()Ljava/lang/Object; (Parsers.scala:891)
at scala.util.DynamicVariable.withValue(Ljava/lang/Object;Lscala/Function0;)Ljava/lang/Object; (DynamicVariable.scala:57)
at scala.util.parsing.combinator.Parsers$$anon$2.apply(Lscala/util/parsing/input/Reader;)Lscala/util/parsing/combinator/Parsers$ParseResult; (Parsers.scala:890)
at scala.util.parsing.combinator.RegexParsers$class.parse(Lscala/util/parsing/combinator/RegexParsers;Lscala/util/parsing/combinator/Parsers$Parser;Ljava/lang/CharSequence;)Lscala/util/parsing/combinator/Parsers$ParseResult; (RegexParsers.scala:148)
at io.gatling.core.session.el.ELCompiler.parse(Lscala/util/parsing/combinator/Parsers$Parser;Ljava/lang/CharSequence;)Lscala/util/parsing/combinator/Parsers$ParseResult; (ELCompiler.scala:179)
at scala.util.parsing.combinator.RegexParsers$class.parseAll(Lscala/util/parsing/combinator/RegexParsers;Lscala/util/parsing/combinator/Parsers$Parser;Ljava/lang/CharSequence;)Lscala/util/parsing/combinator/Parsers$ParseResult; (RegexParsers.scala:164)
at io.gatling.core.session.el.ELCompiler.parseAll(Lscala/util/parsing/combinator/Parsers$Parser;Ljava/lang/CharSequence;)Lscala/util/parsing/combinator/Parsers$ParseResult; (ELCompiler.scala:179)
at io.gatling.core.session.el.ELCompiler.parseEl(Ljava/lang/String;)Lscala/collection/immutable/List; (ELCompiler.scala:196)
at io.gatling.core.session.el.ELCompiler$.compile(Ljava/lang/String;Lscala/reflect/ClassTag;)Lscala/Function1; (ELCompiler.scala:155)
at io.gatling.core.session.el.package$EL$.el$extension(Ljava/lang/String;Lscala/reflect/ClassTag;)Lscala/Function1; (package.scala:23)
at io.gatling.core.Predef$.stringToExpression(Ljava/lang/String;Lscala/reflect/ClassTag;)Lscala/Function1; (Predef.scala:40)
at M03_ConsolidateSubPlanAndSumToChildren.<init>()V (M03_ConsolidateSubPlanAndSumToChildren.scala:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Ljava/lang/reflect/Constructor;[Ljava/lang/Object;)Ljava/lang/Object; (Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance([Ljava/lang/Object;)Ljava/lang/Object; (NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance([Ljava/lang/Object;)Ljava/lang/Object; (DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance([Ljava/lang/Object;)Ljava/lang/Object; (Constructor.java:526)
at java.lang.Class.newInstance()Ljava/lang/Object; (Class.java:379)
at io.gatling.core.runner.Runner.run()Lscala/Tuple2; (Runner.scala:37)
at io.gatling.app.Gatling.start()I (Gatling.scala:236)
at io.gatling.app.Gatling$.fromMap(Lscala/collection/mutable/Map;Lscala/Option;)I (Gatling.scala:55)
at io.gatling.app.Gatling$.runGatling([Ljava/lang/String;Lscala/Option;)I (Gatling.scala:80)
at io.gatling.app.Gatling$.runGatling([Ljava/lang/String;)I (Gatling.scala:59)
at io.gatling.app.Gatling$.main([Ljava/lang/String;)V (Gatling.scala:51)
at io.gatling.app.Gatling.main([Ljava/lang/String;)V (Unknown Source)