Using during in a foreach loop

1,998 views
Skip to first unread message

Patrick Valsecchi

unread,
Jul 13, 2016, 3:21:58 AM7/13/16
to Gatling User Group
Hi,

I'm trying to use Gatling (V2.2.2) to compare the perfs of multiple map servers at different zoom levels with different number of users. So basically, my scenario looks like that:
val scn = scenario("User").group(_ => PerfConfig.nbUsers.toString) {
foreach(PerfConfig.baseUrls, "base_url") {
group(session => PerfConfig.baseUrlMap(session("base_url").as[String])) {
foreach(steps.reverse, "level") {
exec(session => {
println("Starting level " + session("level").as[String])
session
})
.during(30 seconds) {
exec(session => PerfConfig.addRandomTileInfo(session)).exec(fetchTile)
}
.exec(session => {
println("Done level " + session("level").as[String])
session
})
}
}
}
}

The full code can be found there:
https://github.com/pvalsecc/ms_perfs/tree/master/perfs/com/camptocamp

My problem is that after the first iteration of "during" is done, I have multiple un-wanted behaviors:
  • "Done level 7" is printed a lot of times (one for each fetchTile execution, I guess). I don't see why this is like that since it is done after the "during" loop. I've tried to put the "during" inside an exec by itself, but it didn't help.
  • Gatling freezes and doesn't do anymore query. It just prints the summary report every 5 seconds with no new query in it.

It's not possible to chain a "during" with other stuff to do after?


Thanks for your help.

Stéphane LANDELLE

unread,
Jul 13, 2016, 5:13:14 AM7/13/16
to gat...@googlegroups.com
Hi,

Could you please provide a runnable reproducer, please?
This similar sample works fine for me.

Stéphane Landelle
GatlingCorp CEO


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Patrick Valsecchi

unread,
Jul 13, 2016, 8:31:48 AM7/13/16
to gat...@googlegroups.com
Stéphane,

I've tried your reproducer and it works fine with gatling 2.2.1 (with the denvazh/gatling:2.2.1 docker image). With 2.2.2 (with the denvazh/gatling:2.2.2 docker image) it goes mad and outputs that:
gatling_1    | attr1=1 attr2=1
gatling_1    | Loop Done
gatling_1    | Loop Done
.... (tons of them)
gatling_1    | 12:24:24.756 [ERROR] a.a.ActorSystemImpl - Uncaught error from thread [GatlingSystem-akka.actor.default-dispatcher-4] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
gatling_1    | java.lang.StackOverflowError: null
gatling_1    |  at sun.nio.cs.UTF_8.updatePositions(UTF_8.java:77)
gatling_1    |  at sun.nio.cs.UTF_8.access$200(UTF_8.java:57)
gatling_1    |  at sun.nio.cs.UTF_8$Encoder.encodeArrayLoop(UTF_8.java:636)
gatling_1    |  at sun.nio.cs.UTF_8$Encoder.encodeLoop(UTF_8.java:691)
gatling_1    |  at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:579)
gatling_1    |  at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:271)
gatling_1    |  at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
gatling_1    |  at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
gatling_1    |  at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
gatling_1    |  at java.io.PrintStream.write(PrintStream.java:526)
gatling_1    |  at java.io.PrintStream.print(PrintStream.java:669)
gatling_1    |  at java.io.PrintStream.println(PrintStream.java:823)
gatling_1    |  at scala.Console$.println(Console.scala:148)
gatling_1    |  at scala.Predef$.println(Predef.scala:315)
gatling_1    |  at com.camptocamp.ComplexLoopSimulation$$anonfun$2.apply(ComplexLoopSimulation.scala:26)
gatling_1    |  at com.camptocamp.ComplexLoopSimulation$$anonfun$2.apply(ComplexLoopSimulation.scala:25)
gatling_1    |  at io.gatling.core.action.SessionHook.execute(SessionHook.scala:38)
gatling_1    |  at io.gatling.core.action.BlockExit.exitBlock(BlockExit.scala:37)
gatling_1    |  at io.gatling.core.action.BlockExit$.noBlockExitTriggered(BlockExit.scala:122)
gatling_1    |  at io.gatling.core.action.Loop.execute(Loop.scala:52)
gatling_1    |  at io.gatling.core.action.Action$class.$bang(Action.scala:35)
gatling_1    |  at io.gatling.core.action.Loop.$bang(Loop.scala:36)
gatling_1    |  at io.gatling.core.action.SessionHook.io$gatling$core$action$SessionHook$$$anonfun$1(SessionHook.scala:38)
gatling_1    |  at io.gatling.core.action.SessionHook$lambda$$execute$1.apply(SessionHook.scala:38)
gatling_1    |  at io.gatling.core.action.SessionHook$lambda$$execute$1.apply(SessionHook.scala:38)
gatling_1    |  at io.gatling.commons.validation.Success.map(Validation.scala:32)
gatling_1    |  at io.gatling.core.action.SessionHook.execute(SessionHook.scala:38)
gatling_1    |  at io.gatling.core.action.BlockExit.exitBlock(BlockExit.scala:37)
gatling_1    |  at io.gatling.core.action.BlockExit$.noBlockExitTriggered(BlockExit.scala:122)
... (smells like an infinite recusion)

With 2.2.1, my stuff works fine. So, looks like a bug within the 2.2.2 image.

Thanks for your help.

--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/26pp-EfysiI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.

Stéphane LANDELLE

unread,
Jul 13, 2016, 8:57:50 AM7/13/16
to gat...@googlegroups.com
You're running into https://github.com/gatling/gatling/issues/3060, which is already fixed.
Use the snapshot for now.

Stéphane Landelle
GatlingCorp CEO


Reply all
Reply to author
Forward
0 new messages