Search code examples
scalamavenscala-gatlinggatling-pluginmaven-gatling-plugin

mvn gatling:test throws java.lang.StackOverflowError error


I just upgraded my Gatling from 3.3 to version 3.7.6. Now when I try to execute mvn gatling:test or ./mvnw clean gatling:test -Dgatling.simulationClass==ai.slit.brb.gatling.simulations.ActSimulation, I get a StackOverflow Error.

I have tried most of the online solutions but none seems to work for me. What could I be missing?

enter image description here

Below is my pom.xml file:

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <gatling.version>3.7.6</gatling.version>
    <gatling-maven-plugin.version>4.1.5</gatling-maven-plugin.version>
    <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
    <scala-maven-plugin.version>4.6.1</scala-maven-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-app</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-recorder</artifactId>
      <version>${gatling.version}</version>
    </dependency>
  </dependencies>

  <build>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>${scala-maven-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <jvmArgs>
            <jvmArg>-Xms1g</jvmArg>
            <jvmArg>-Xmx4g</jvmArg>
            <jvmArg>-XX:MaxPermSize=1024m</jvmArg>
          </jvmArgs>
          <args>
            <arg>-target:jvm-1.8</arg>
            <arg>-deprecation</arg>
            <arg>-feature</arg>
            <arg>-unchecked</arg>
            <arg>-language:implicitConversions</arg>
            <arg>-language:postfixOps</arg>
          </args>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
        <configuration>
          <runMultipleSimulations>true</runMultipleSimulations>
          <simulationsFolder>src/test/scala/ai/slit/brb/gatling/simulations</simulationsFolder>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

I have tried to increase memory size, and all other suggestions but none seems to work for me.


Solution

  • Gatling's documentation recommends to check the demo projects. Please check the one for maven + Scala. You're missing the -Xss parameter.