Parsing log file(s)... java.lang.OutOfMemoryError: Java heap space

I am using Gatling 3.5.0,
I have 5 test case classes , each test case only send 1 HTTP request for 1 second.
I run 5 test cases one after the other.

The problem is after I run the test roughly 5 times using “mvn gatling:test” , I will get 1 Build Failure while parsing log file.

Parsing log file(s)…
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid89460.hprof …
Heap dump file created [1978735703 bytes in 7.614 secs]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.lang.Integer.valueOf(Integer.java:832)
at scala.runtime.BoxesRunTime.boxToInteger(BoxesRunTime.java:63)
at scala.collection.immutable.RangeIterator.next(Range.scala:639)
at scala.collection.immutable.Range.map(Range.scala:59)
at io.gatling.charts.stats.StatsHelper$.buckets(StatsHelper.scala:22)
at io.gatling.charts.stats.LogFileReader.(LogFileReader.scala:151)
at io.gatling.app.RunResultProcessor.initLogFileReader(RunResultProcessor.scala:52)
at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:34)
at io.gatling.app.Gatling$.start(Gatling.scala:89)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:45)
at io.gatling.app.Gatling$.main(Gatling.scala:37)
at io.gatling.app.Gatling.main(Gatling.scala)
… 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.185 s
[INFO] Finished at: 2020-12-23T16:07:04+13:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.gatling:gatling-maven-plugin:3.1.0:test (default-cli) on project BeingWellRegisterLoginLoadTest: Gatling failed.: Process exited with an error: -1 (Exit value: -1) → [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

My POM.xml looks like this

<?xml version="1.0" encoding="UTF-8"?>


4.0.0
org.example
BeingWellRegisterLoginLoadTest
1.0-SNAPSHOT

1.8 1.8 UTF-8

<gatling.version>3.5.0</gatling.version>
<gatling-maven-plugin.version>3.1.0</gatling-maven-plugin.version>
<scala-maven-plugin.version>4.4.0</scala-maven-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>

io.gatling.highcharts gatling-charts-highcharts ${gatling.version} io.gatling gatling-app ${gatling.version} io.gatling gatling-recorder ${gatling.version} src/test/scala maven-jar-plugin ${maven-jar-plugin.version} net.alchim31.maven scala-maven-plugin ${scala-maven-plugin.version} testCompile -Xss20G -Xms20G -Xmx100G -target:jvm-1.11 -deprecation -feature -unchecked -language:implicitConversions -language:postfixOps io.gatling gatling-maven-plugin ${gatling-maven-plugin.version} test ${project.basedir}/src/test/scala ${project.basedir}/src/test/resources ${project.basedir}/target/gatling

true

testCases.Register testCases.PersonalizeFormWithGUID testCases.Login testCases.GenerateToken testCases.Inquiry

When I downgrade the Gatling version to 3.3.1 , then I don’t see this error (I only have run it for 8 times so far and I didn’t get any Build Failure at all. Probably I will need to run it more later to further verify it)

My logback.xml looks like this

<?xml version="1.0" encoding="UTF-8"?> %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx false ./src/test/resources/Logs ./src/test/resources/Logs/loadTest.log true %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx

Is there any known issue with the newest Gatling version 3.5.0 , or something is not right with my POM.xml or my logback.xml ?

Thanks
Jimmy

Please provide some concrete information such we can investigate, eg: your simulation.log, a heap dump (the aforementioned hprof file).

I’m just responding to say that I had this problem as wel. I’ve found the underlaying problem by adding the following logger to my log4j.xml

With the logging now showing all the failed request, I found out that there was something wrong with my testcase. I hope this helps somebody.