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