Error message: You must call startCounter before this method is called

Hi all,
In our scenario, we’ve got the following exception:

] shutting down JVM since ‘akka.jvm-exit-on-fatal-error’ is enabled for ActorSystem[GatlingSystem]
java.lang.IllegalAccessError: You must call startCounter before this method is called
at com.excilys.ebi.gatling.core.session.handler.CounterBasedIterationHandler$$anonfun$increment$2.apply(CounterBasedterationHandler.scala:38)
at com.excilys.ebi.gatling.core.session.handler.CounterBasedIterationHandler$$anonfun$increment$2.apply(CounterBasedterationHandler.scala:38)
at scala.Option.getOrElse(Option.scala:108)
at com.excilys.ebi.gatling.core.session.handler.CounterBasedIterationHandler$class.increment(CounterBasedterationHandler.scala:37)

We use Gatling 1.4.2 and our scenario is:

val scn = scenario(“Hello World: Simple Benchmark”)
.exec(
channel(“test”)
.open(“whatever://xxx:yyy/?appName=helloWorld&appVersion=3.0.0”, “open”)

.serializable(classOf[Person])
.serializable(classOf[Counter]))
.pause(100 milliseconds)

.repeat(5) {
exec(
channel(“test”)
.send(“hello”, “”, “send-and-wait-hello”)
.check(messageType.is(“hello”)))
.pause(scala.math.abs(random.nextInt(10)) milliseconds)
}

.exec(
channel(“test”).close(“close”))
.pause(100 milliseconds)

As you may have already guessed, we have extended Gatling with our own protocol but I have no clue about what this exception means. On the other hand, the post https://groups.google.com/forum/#!msg/gatling/AagblHSBtlo/g2RPNhViZ6kJ seems to report a similar issue. So I was wondering if this could be related. If not, any idea about our issue and how we could fix it?

We use:

  • Gatling 1.4.2

  • JDK 1.6.0_30

  • Scala 2.9.3

  • Ubuntu 12.10

Thanks in advance!

Hi,

This error means that the Session doesn’t contain the repeat loop counter.

What I fail to see is how this could happen?!
Did you edit Gatling’s code, like making Session mutable?

Could you provide the full stacktrace, please?

Cheers,

Stéphane

PS: Beware that we’re building Gatling 2, so we’re breaking a “few” things.

No, I didn’t edit Gatling code. Just used the release 1.4.2 from maven.
Here is the full stacktrace:

java.lang.IllegalAccessError: You must call startCounter before this method is called
at com.excilys.ebi.gatling.core.session.handler.CounterBasedIterationHandler$$anonfun$increment$2.apply(CounterBasedterationHandler.scala:38)
at com.excilys.ebi.gatling.core.session.handler.CounterBasedIterationHandler$$anonfun$increment$2.apply(CounterBasedterationHandler.scala:38)
at scala.Option.getOrElse(Option.scala:108)
at com.excilys.ebi.gatling.core.session.handler.CounterBasedIterationHandler$class.increment(CounterBasedterationHandler.scala:37)
at com.excilys.ebi.gatling.core.structure.Loops$$anon$1.increment(Loops.scala:38)
at com.excilys.ebi.gatling.core.structure.Loops$$anonfun$3.apply(Loops.scala:43)
at com.excilys.ebi.gatling.core.structure.Loops$$anonfun$3.apply(Loops.scala:43)
at com.excilys.ebi.gatling.core.action.SimpleAction.execute(SimpleAction.scala:37)
at com.excilys.ebi.gatling.core.action.Action$$anonfun$receive$1.apply(Action.scala:31)
at com.excilys.ebi.gatling.core.action.Action$$anonfun$receive$1.apply(Action.scala:30)
at akka.actor.Actor$class.apply(Actor.scala:318)
at com.excilys.ebi.gatling.core.action.SimpleAction.apply(SimpleAction.scala:29)
at akka.actor.ActorCell.invoke(ActorCell.scala:626)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197)
at akka.dispatch.Mailbox.run(Mailbox.scala:179)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516)
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479)
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

Cheers.

OK, I think I get it.

Your channel/send (AMQP, BTW?) probably doesn’t properly pass the Session to the next Action in the chain. For example, you might be passing a fresh Session instance. Anyway, it lacks the loop counter (of course Gatling also store private data into the Session).

You can verify this with a session function:

val scn = scenario(“Hello World: Simple Benchmark”)
.exec(
channel(“test”)
.open(“whatever://xxx:yyy/?appName=helloWorld&appVersion=3.0.0”, “open”)

.serializable(classOf[Person])
.serializable(classOf[Counter]))
.pause(100 milliseconds)

.repeat(5) {
exec(session => println(session); session) // ← here, you should see the counter in the first iteration
.exec(
channel(“test”)
.send(“hello”, “”, “send-and-wait-hello”)
.check(messageType.is(“hello”)))
.pause(scala.math.abs(random.nextInt(10)) milliseconds)
.exec(session => println(session); session) // ← the counter should be missing here since first iteration
}

.exec(
channel(“test”).close(“close”))
.pause(100 milliseconds)

Please let me know if I guessed right.
Honestly, I really think the problem is on your side, I can’t see how the problem could be on ours.

Cheers,

Stéphane

Well, it looks like this! I will investigate in this way.

Many thanks for the help!

PS: no, it’s not AMQP but a proprietary protocol…