1

我有两个HTTP端点聊天类服务:加特林抛出InvalidActorNameException当测试长查询HTTP请求

  • POST /聊天/用于发布消息
  • GET /聊天/调查/接收消息在长查询方式

POST请求返回一个错误,如果有最后N分钟内没有注册的监听,所以我必须先制作一个长查询GET请求。 我试图用加特林的poll功能,但我发现了一个InvalidActorNameException一些虚拟用户

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)) 

完整的异常堆栈跟踪是

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) 

我可以使用加特林测试长时间轮询请求还是尚未支持?

回答

1

确实是一个bug,感谢报告。 修正︰https://github.com/gatling/gatling/issues/2970

+0

谢谢,斯蒂芬!我目前使用io.gatling.highcharts:gatling-charts-highcharts:2.2.0,但我无法在快照库中找到此工件。如果我不想等待另一个版本,我应该使用另一个依赖项吗? – bedrin

+1

https://oss.sonatype.org/content/repositories/snapshots/io/gatling/highcharts/gatling-charts-highcharts/2.3.0-SNAPSHOT/ –

+0

谢谢!一定是浏览器缓存 – bedrin