1
votes

I have a chat-like service with two HTTP endpoints:

  • POST /chat/ for publishing messages
  • GET /chat/poll/ for receiving messages in a long-poll manner

POST request returns an error if there are no registered listeners within last N minutes, so I have to make a long-poll GET request first. I'm trying to use the poll functionality of Gatling but I'm getting an InvalidActorNameException for some of virtual users

val scn = scenario("Chat").
    feed(csv("users.csv").random).
    exec(session => session.set("test-user-name","${userEmail}")).
    exec(authenticateInSamlService).
    exec(
      polling.
        every(100 millis).
        exec(
          http("Poll Chat Mesages").
            get("/chat/poll/")
            queryParam("test-user-name","${test-user-name}")
            header("X-Session-Id", "Session0")
            check status.is(200)
            check bodyString.is("YOMOMMA")
        )
    ).
    pause(2 seconds).
    exec(
      http("Send Chat Messag").
        post("/chat/")
        queryParam("test-user-name","${test-user-name}")
        header("Content-Type", "application/octet-stream")
        header("X-Session-Id", "Session2")
        body StringBody("YOMOMMA")
        check status.is(201)
    ).
    pause(2 seconds).
    exec(polling.stop)

setUp(scn.inject(
    atOnceUsers(1),
    rampUsers(20) over (20 seconds)
  ).protocols(httpConf))

The full exception stack trace is

akka.actor.InvalidActorNameException: actor name [gatling.http.polling-5-actor] is not unique!
    at akka.actor.dungeon.ChildrenContainer$NormalChildrenContainer.reserve(ChildrenContainer.scala:129)
    at akka.actor.dungeon.Children$class.reserveChild(Children.scala:130)
    at akka.actor.ActorCell.reserveChild(ActorCell.scala:374)
    at akka.actor.dungeon.Children$class.makeChild(Children.scala:268)
    at akka.actor.dungeon.Children$class.attachChild(Children.scala:46)
    at akka.actor.ActorCell.attachChild(ActorCell.scala:374)
    at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:589)
    at io.gatling.http.action.async.polling.PollingStart.startPolling$1(PollingStart.scala:55)
    at io.gatling.http.action.async.polling.PollingStart.io$gatling$http$action$async$polling$PollingStart$$$anonfun$1(PollingStart.scala:67)
    at io.gatling.http.action.async.polling.PollingStart.io$gatling$http$action$async$polling$PollingStart$$$anonfun$1$adapted(PollingStart.scala:67)
    at io.gatling.commons.validation.Success.map(Validation.scala:32)
    at io.gatling.http.action.async.polling.PollingStart.execute(PollingStart.scala:67)
    at io.gatling.core.action.Action$class.$bang(Action.scala:35)
    at io.gatling.http.action.async.polling.PollingStart.io$gatling$core$action$ChainableAction$$super$$bang(PollingStart.scala:30)
    at io.gatling.core.action.ChainableAction$class.$bang(Action.scala:60)
    at io.gatling.http.action.async.polling.PollingStart.io$gatling$core$action$ExitableAction$$super$$bang(PollingStart.scala:30)
    at io.gatling.core.action.ExitableAction$class.io$gatling$core$action$ExitableAction$class$$$anonfun$3(BlockExit.scala:140)
    at io.gatling.core.action.ExitableAction$class.io$gatling$core$action$ExitableAction$class$$$anonfun$3$adapted(BlockExit.scala:140)
    at io.gatling.core.action.ExitableAction$.exitOrElse(BlockExit.scala:125)
    at io.gatling.core.action.ExitableAction$class.$bang(BlockExit.scala:140)
    at io.gatling.http.action.async.polling.PollingStart.$bang(PollingStart.scala:30)
    at io.gatling.core.action.SessionHook.io$gatling$core$action$SessionHook$$$anonfun$1(SessionHook.scala:38)
    at io.gatling.core.action.SessionHook.io$gatling$core$action$SessionHook$$$anonfun$1$adapted(SessionHook.scala:38)
    at io.gatling.commons.validation.Success.map(Validation.scala:32)
    at io.gatling.core.action.SessionHook.execute(SessionHook.scala:38)
    at io.gatling.core.action.Action$class.$bang(Action.scala:35)
    at io.gatling.core.action.SessionHook.io$gatling$core$action$ChainableAction$$super$$bang(SessionHook.scala:30)
    at io.gatling.core.action.ChainableAction$class.$bang(Action.scala:60)
    at io.gatling.http.action.sync.AddCookieBuilder$$anon$1.io$gatling$core$action$ExitableAction$$super$$bang(AddCookieBuilder.scala:77)
    at io.gatling.core.action.ExitableAction$class.io$gatling$core$action$ExitableAction$class$$$anonfun$3(BlockExit.scala:140)
    at io.gatling.core.action.ExitableAction$class.io$gatling$core$action$ExitableAction$class$$$anonfun$3$adapted(BlockExit.scala:140)
    at io.gatling.core.action.ExitableAction$.exitOrElse(BlockExit.scala:125)
    at io.gatling.core.action.ExitableAction$class.$bang(BlockExit.scala:140)
    at io.gatling.http.action.sync.AddCookieBuilder$$anon$1.$bang(AddCookieBuilder.scala:77)
    at io.gatling.http.ahc.ResponseProcessor.executeNext(ResponseProcessor.scala:144)
    at io.gatling.http.ahc.ResponseProcessor.logAndExecuteNext(ResponseProcessor.scala:169)
    at io.gatling.http.ahc.ResponseProcessor.checkAndProceed$1(ResponseProcessor.scala:291)
    at io.gatling.http.ahc.ResponseProcessor.processResponse(ResponseProcessor.scala:321)
    at io.gatling.http.ahc.ResponseProcessor.onCompleted(ResponseProcessor.scala:61)
    at io.gatling.http.ahc.AsyncHandler.onCompleted(AsyncHandler.scala:127)
    at io.gatling.http.ahc.AsyncHandler.onCompleted(AsyncHandler.scala:46)
    at org.asynchttpclient.netty.NettyResponseFuture.getContent(NettyResponseFuture.java:188)
    at org.asynchttpclient.netty.NettyResponseFuture.done(NettyResponseFuture.java:223)
    at org.asynchttpclient.netty.handler.HttpHandler.finishUpdate(HttpHandler.java:58)
    at org.asynchttpclient.netty.handler.HttpHandler.handleChunk(HttpHandler.java:159)
    at org.asynchttpclient.netty.handler.HttpHandler.handleRead(HttpHandler.java:189)
    at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:82)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:428)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:277)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:264)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:243)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
    at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:240)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1070)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:904)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:387)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:245)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:962)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:485)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:399)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:371)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
    at java.lang.Thread.run(Thread.java:745)

Can I use Gatling for testing long-poll requests or it is not supported yet?

1

1 Answers