Gatling 2 - master - foreach crashes

559 views
Skip to first unread message

Stefan Magnus Landrø

unread,
May 29, 2013, 5:14:29 AM5/29/13
to gat...@googlegroups.com
Hi there,
 
I'm trying to use a foreach block in my scenario.
 
I've tried both alternatives (both crash):
 
.foreach("${ids}", "id", "counter") {
exec(.....)
}
.foreach("${ids}", "id") {
exec(.....)
}
 
However, the repeat block works as expected
 
 
It crashes, due to what seems to be an error in Loops.scala:
 
  def counterValue(implicit counterName: CounterName) = session(counterName.name).asInstanceOf[Int]
 
 
Stacktrace from simulation
 
java.lang.ClassCastException: io.gatling.core.session.SessionAttribute cannot be cast to java.lang.Integer
 at scala.runtime.BoxesRunTime.unboxToInt(Unknown Source)
 at io.gatling.core.structure.Loops$SessionCounters$.counterValue$extension(Loops.scala:39)
 at io.gatling.core.structure.Loops$$anonfun$6$$anonfun$apply$3.apply(Loops.scala:84)
 at io.gatling.core.structure.Loops$$anonfun$6$$anonfun$apply$3.apply(Loops.scala:84)

Stéphane Landelle

unread,
May 29, 2013, 5:32:24 AM5/29/13
to gat...@googlegroups.com
Hi Stefan,

Fixed, thanks!


2013/5/29 Stefan Magnus Landrø <stefan...@gmail.com>

--
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/groups/opt_out.
 
 

E. Ulrich Kriegel

unread,
Apr 9, 2014, 5:59:37 AM4/9/14
to gat...@googlegroups.com
I habe a similar problem with Gatling 2.0.0M3a
The body of foreach is executed in the correct way, but afterwards the following exception occurs


[ERROR] [04/09/2014 11:46:23.697] [GatlingSystem-akka.actor.default-dispatcher-3] [akka://GatlingSystem/user/$c/$a] tail of empty list

java.lang.UnsupportedOperationException: tail of empty list

at scala.collection.immutable.Nil$.tail(List.scala:339)

at scala.collection.immutable.Nil$.tail(List.scala:334)

at io.gatling.core.session.Session.exitInterruptable(Session.scala:105)

at io.gatling.core.action.InnerWhile$$anonfun$3.applyOrElse(While.scala:54)

at io.gatling.core.action.InnerWhile$$anonfun$3.applyOrElse(While.scala:54)

at io.gatling.core.action.InnerWhile.execute(While.scala:68)

at io.gatling.core.action.Action$$anonfun$receive$1.applyOrElse(Action.scala:27)

at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)

at akka.actor.ActorCell.invoke(ActorCell.scala:386)

at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)

at akka.dispatch.Mailbox.run(Mailbox.scala:212)

at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506)

at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)

at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)

at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)

at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)


11:46:23.712 [ERROR] i.g.c.a.InnerWhile - Action InnerWhile crashed, forwarding user to next one

java.lang.UnsupportedOperationException: tail of empty list

at scala.collection.immutable.Nil$.tail(List.scala:339) ~[na:na]

at scala.collection.immutable.Nil$.tail(List.scala:334) ~[na:na]

at io.gatling.core.session.Session.exitInterruptable(Session.scala:105) ~[gatling-core-2.0.0.20130628.jar:na]

at io.gatling.core.action.InnerWhile$$anonfun$3.applyOrElse(While.scala:54) ~[gatling-core-2.0.0.20130628.jar:na]

at io.gatling.core.action.InnerWhile$$anonfun$3.applyOrElse(While.scala:54) ~[gatling-core-2.0.0.20130628.jar:na]

at io.gatling.core.action.InnerWhile.execute(While.scala:68) ~[gatling-core-2.0.0.20130628.jar:na]

at io.gatling.core.action.Action$$anonfun$receive$1.applyOrElse(Action.scala:27) ~[gatling-core-2.0.0.20130628.jar:na]

at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) ~[akka-actor_2.10-2.1.4.jar:na]

at akka.actor.ActorCell.invoke(ActorCell.scala:386) ~[akka-actor_2.10-2.1.4.jar:na]

at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) ~[akka-actor_2.10-2.1.4.jar:na]

at akka.dispatch.Mailbox.run(Mailbox.scala:212) ~[akka-actor_2.10-2.1.4.jar:na]

at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [akka-actor_2.10-2.1.4.jar:na]

at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [na:na]

at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [na:na]

at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [na:na]

at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [na:na]


-- Ulrich

Nicolas Rémond

unread,
Apr 9, 2014, 6:31:21 AM4/9/14
to gat...@googlegroups.com
Hi,

What does your scenario looks like?

I tried with :

 scenario("Debug test")
    .exec(_.set("ids", List(1,2,3)))
    .foreach("${ids}", "id") {
      exec(http("with id").get("/hello?id=$id"))
    }

but on the SNAPSHOT version, I can't reproduce.

cheers
Nicolas



For more options, visit https://groups.google.com/d/optout.

E. Ulrich Kriegel

unread,
Apr 9, 2014, 9:10:28 AM4/9/14
to gat...@googlegroups.com
Hi Nicolas,
i constructed the following simplified scenario which runs and results in the same exception

[ERROR] [04/09/2014 15:04:40.353] [GatlingSystem-akka.actor.default-dispatcher-10] [akka://GatlingSystem/user/$b/$a] tail of empty list



class DummySimulation extends Simulation {


    val headers= Map(

                ......

"Accept" -> "application/json",

"Content-Type" -> "application/json; charset=utf-8")

val httpProtocol= http.baseURL("https://......")

val scn = scenario("get profile")

.exec(_.set("ids",List("C9C21AF3-C8B4-456C-8CB8-083A566B0434", "C9C21AF3-C8B4-456C-8CB8-083A566B0434")))

.foreach("${ids}","id"){

    exec(

http("test")

    .get("/test")

    .headers(headers)

.header("TEST-UID","${id}")

.check(status.saveAs("status"), status.in(Seq(200,404)))

)}

setUp(

    scn.inject(constantRate(1 usersPerSec) during (1 seconds)))

.protocols(httpProtocol)

}

Nicolas Rémond

unread,
Apr 9, 2014, 10:57:14 AM4/9/14
to gat...@googlegroups.com
Just tested on master, everything works fine. 
Given the fact that we will release soon, you should rather move to a SNAPSHOT version.


scenario I used:

package nico

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

import scala.concurrent.duration._

import scala.language.postfixOps

class DummySimulation extends Simulation {

  val headers = Map(
    "Accept" -> "application/json",
    "Content-Type" -> "application/json; charset=utf-8")

  val httpProtocol = http.baseURL("http://localhost:5000").disableWarmUp

  val scn = scenario("get profile")
    .exec(_.set("ids", List("C9C21AF3-C8B4-456C-8CB8-083A566B0434", "C9C21AF3-C8B4-456C-8CB8-083A566B0434")))
    .foreach("${ids}", "id") {
      exec(
        http("test")
          .get("/")
          .headers(headers)
          .header("TEST-UID", "${id}")
          .check(status.saveAs("status"), status.in(Seq(200, 404))))
    }

  setUp(
    scn.inject(constantUsersPerSec(1) during (1 seconds)))
    .protocols(httpProtocol)
}

Message has been deleted

E. Ulrich Kriegel

unread,
Apr 9, 2014, 11:47:20 AM4/9/14
to gat...@googlegroups.com
Thanks, 
btw: what does soon mean? ;-)
Reply all
Reply to author
Forward
0 new messages