IndexOutOfBoundsException during check on bodyBytes

Hi,
Exception is thrown when I execute

check(bodyBytes.transform(_.length).greaterThan(0)))
On chunked response 

Gatling 2.2.3

Script to reproduce :

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

class TestChunkedResponse extends Simulation {

 val httpProtocol = http
  .baseURL("http://www.httpwatch.com")
  .disableFollowRedirect
  .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
  .acceptEncodingHeader("gzip, deflate")
  .acceptLanguageHeader("en-US,en;q=0.5")
  .userAgentHeader("Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.7.0")

 val uri1 = "http://www.httpwatch.com/httpgallery/chunked/chunkedimage.aspx"

 val scn = scenario("TestChunkedResponse")
  .exec(http("request_0")
   .get("/httpgallery/chunked/chunkedimage.aspx?0.7002945220948651")
     .check(bodyBytes.transform(_.length).greaterThan(0)))

 setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}

Stack :

G] i.g.h.a.AsyncHandler - Request 'request_0' failed for user 1
java.lang.IndexOutOfBoundsException: index: 0, length: 33653 (expected: range(0, 578))
	at io.netty.buffer.AbstractByteBuf.checkIndex0(AbstractByteBuf.java:1125) ~[netty-buffer-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.buffer.SlicedByteBuf.getBytes(SlicedByteBuf.java:201) ~[netty-buffer-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.buffer.AbstractByteBuf.getBytes(AbstractByteBuf.java:440) ~[netty-buffer-4.0.42.Final.jar:4.0.42.Final]
	at io.gatling.commons.util.ByteBufs$.io$gatling$commons$util$ByteBufs$$$anonfun$2(ByteBufs.scala:32) ~[gatling-commons-2.2.3.jar:2.2.3]
	at io.gatling.commons.util.ByteBufs$.io$gatling$commons$util$ByteBufs$$$anonfun$2$adapted(ByteBufs.scala:31) ~[gatling-commons-2.2.3.jar:2.2.3]
	at scala.collection.immutable.List.foreach(List.scala:381) ~[scala-library-2.11.8.jar:na]
	at io.gatling.commons.util.ByteBufs$.byteBufsToByteArray(ByteBufs.scala:31) ~[gatling-commons-2.2.3.jar:2.2.3]
	at io.gatling.http.response.ByteArrayResponseBody$.apply(ResponseBody.scala:90) ~[gatling-http-2.2.3.jar:2.2.3]
	at io.gatling.http.response.ResponseBuilder.build(ResponseBuilder.scala:189) ~[gatling-http-2.2.3.jar:2.2.3]
	at io.gatling.http.ahc.AsyncHandler.withResponse(AsyncHandler.scala:126) [gatling-http-2.2.3.jar:2.2.3]
	at io.gatling.http.ahc.AsyncHandler.onCompleted(AsyncHandler.scala:134) [gatling-http-2.2.3.jar:2.2.3]
	at io.gatling.http.ahc.AsyncHandler.onCompleted(AsyncHandler.scala:47) [gatling-http-2.2.3.jar:2.2.3]
	at org.asynchttpclient.netty.NettyResponseFuture.getContent(NettyResponseFuture.java:181) [async-http-client-2.0.24.jar:na]
	at org.asynchttpclient.netty.NettyResponseFuture.done(NettyResponseFuture.java:215) [async-http-client-2.0.24.jar:na]
	at org.asynchttpclient.netty.handler.HttpHandler.finishUpdate(HttpHandler.java:58) [async-http-client-2.0.24.jar:na]
	at org.asynchttpclient.netty.handler.HttpHandler.handleChunk(HttpHandler.java:159) [async-http-client-2.0.24.jar:na]
	at org.asynchttpclient.netty.handler.HttpHandler.handleRead(HttpHandler.java:187) [async-http-client-2.0.24.jar:na]
	at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:76) [async-http-client-2.0.24.jar:na]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:346) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:346) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [netty-codec-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:346) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) [netty-codec-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:354) [netty-codec-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:325) [netty-codec-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.handler.codec.http.HttpClientCodec$Decoder.channelInactive(HttpClientCodec.java:228) [netty-codec-http-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.CombinedChannelDuplexHandler.channelInactive(CombinedChannelDuplexHandler.java:220) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:251) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:230) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1289) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:251) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:893) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:691) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:408) [netty-common-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:455) [netty-transport-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140) [netty-common-4.0.42.Final.jar:4.0.42.Final]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) [netty-common-4.0.42.Final.jar:4.0.42.Final]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]

Thanks a lot,

log.log (14.1 KB)

TestChunkedResponse.scala (834 Bytes)

Hi,

Is this something that you can reproduce every time?

I haven’t been able to reproduce with current master. Could you please check it out?

Thanks,

I will try tomorrow with a 3.0.0-snapshot bundle. The problem could not be related to this fixed bug in the master https://github.com/gatling/gatling/pull/3191

Its work with bundle 3.0.0-snapshot but not in version 2.2.3

Thanks for your feedback. So indeed, your problem is #3191

You will fix it in 2.2.X ??

We don’t plan on releasing 2.2.x, except for our FrontLine customers.

Cool - I had exactly the same problem :slight_smile: