BufferUnderflowException ~ xpath/vtdXpath + Gatling 1.5.2

Hi,

I am trying to exec an xpath to put the resulting value from the xpath expression into the user session so I can use it for subsequent exec (not in the script below). I have also tried vtdXpath(). I’ve searched the forums and documentation regarding my approach and exception and am coming up short on my own. Exception and the Gatling 1.5.2 .scala script is pasted below.

Help folks can offer would be very appreciated!!

Response DefaultHttpResponse(chunked: true)

HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, /; q=.2

SOAPAction: “”

Content-Type: text/xml;charset=utf-8

Content-Length: 12150

13:25:34.626 [New I/O worker #2] DEBUG c.n.h.c.p.netty.NettyConnectionsPool - Adding uri: 1http://redacted for channel [id: 0xf6957158, /172.18.155.240:61903 => redacted/127.0.0.1:8080]

[ERROR] [08/04/2013 13:25:34.681] [GatlingSystem-akka.actor.default-dispatcher-7] [akka://GatlingSystem/user/$c/$a] null

java.nio.BufferUnderflowException

at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:127)

at com.excilys.ebi.gatling.core.util.ByteBufferInputStream.read(ByteBufferInputStream.scala:30)

at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source)

at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)

at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)

at org.apache.xerces.impl.XMLEntityScanner.scanLiteral(Unknown Source)

at org.apache.xerces.impl.XMLScanner.scanAttributeValue(Unknown Source)

at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanAttribute(Unknown Source)

at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)

at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)

at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)

at com.excilys.ebi.gatling.core.check.extractor.xpath.XPathExtractor$$anonfun$1$$anonfun$apply$1.apply(XPathExtractor.scala:60)

at com.excilys.ebi.gatling.core.check.extractor.xpath.XPathExtractor$$anonfun$1$$anonfun$apply$1.apply(XPathExtractor.scala:58)

at com.excilys.ebi.gatling.core.util.IOHelper$.use(IOHelper.scala:22)

at com.excilys.ebi.gatling.core.check.extractor.xpath.XPathExtractor$$anonfun$1.apply(XPathExtractor.scala:58)

at com.excilys.ebi.gatling.core.check.extractor.xpath.XPathExtractor$$anonfun$1.apply(XPathExtractor.scala:58)

at scala.Option.map(Option.scala:133)

at com.excilys.ebi.gatling.core.check.extractor.xpath.XPathExtractor$.apply(XPathExtractor.scala:57)

at com.excilys.ebi.gatling.http.check.body.HttpBodyXPathCheckBuilder$.newExtractor$1(HttpBodyXPathCheckBuilder.scala:35)

at com.excilys.ebi.gatling.http.check.body.HttpBodyXPathCheckBuilder$$anonfun$com$excilys$ebi$gatling$http$check$body$HttpBodyXPathCheckBuilder$$getCachedExtractor$1.apply(HttpBodyXPathCheckBuilder.scala:38)

at com.excilys.ebi.gatling.http.check.body.HttpBodyXPathCheckBuilder$$anonfun$com$excilys$ebi$gatling$http$check$body$HttpBodyXPathCheckBuilder$$getCachedExtractor$1.apply(HttpBodyXPathCheckBuilder.scala:38)

at com.excilys.ebi.gatling.core.check.CheckContext$$anonfun$getOrUpdateCheckContextAttribute$1.apply(CheckContext.scala:59)

at scala.Option.getOrElse(Option.scala:108)

at com.excilys.ebi.gatling.core.check.CheckContext$.getOrUpdateCheckContextAttribute(CheckContext.scala:58)

at com.excilys.ebi.gatling.http.check.body.HttpBodyXPathCheckBuilder$.com$excilys$ebi$gatling$http$check$body$HttpBodyXPathCheckBuilder$$getCachedExtractor(HttpBodyXPathCheckBuilder.scala:38)

at com.excilys.ebi.gatling.http.check.body.HttpBodyXPathCheckBuilder$$anonfun$com$excilys$ebi$gatling$http$check$body$HttpBodyXPathCheckBuilder$$newFindExtractorFactory$1.apply(HttpBodyXPathCheckBuilder.scala:41)

at com.excilys.ebi.gatling.http.check.body.HttpBodyXPathCheckBuilder$$anonfun$com$excilys$ebi$gatling$http$check$body$HttpBodyXPathCheckBuilder$$newFindExtractorFactory$1.apply(HttpBodyXPathCheckBuilder.scala:41)

at com.excilys.ebi.gatling.core.check.MatcherCheckBuilder$$anon$2.apply(CheckBuilder.scala:108)

at com.excilys.ebi.gatling.core.check.MatcherCheckBuilder$$anon$2.apply(CheckBuilder.scala:105)

at com.excilys.ebi.gatling.core.check.Check.apply(Check.scala:65)

at com.excilys.ebi.gatling.core.check.Check$.applyChecksRec$1(Check.scala:41)

at com.excilys.ebi.gatling.core.check.Check$$anonfun$applyChecks$1.apply(Check.scala:50)

at com.excilys.ebi.gatling.core.check.Check$$anonfun$applyChecks$1.apply(Check.scala:50)

at com.excilys.ebi.gatling.core.check.CheckContext$.useCheckContext(CheckContext.scala:41)

at com.excilys.ebi.gatling.core.check.Check$.applyChecks(Check.scala:49)

at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor.checkPhasesRec$1(GatlingAsyncHandlerActor.scala:229)

at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor.com$excilys$ebi$gatling$http$ahc$GatlingAsyncHandlerActor$$processResponse(GatlingAsyncHandlerActor.scala:241)

at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor$$anonfun$receive$1.apply(GatlingAsyncHandlerActor.scala:108)

at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor$$anonfun$receive$1.apply(GatlingAsyncHandlerActor.scala:84)

at akka.actor.Actor$class.apply(Actor.scala:318)

at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor.apply(GatlingAsyncHandlerActor.scala:70)

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

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

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

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

at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)

at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)

at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479)

at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

Gatling 1.5.2 script:

import com.excilys.ebi.gatling.core.Predef._

import com.excilys.ebi.gatling.http.Predef._

import com.excilys.ebi.gatling.jdbc.Predef._

import com.excilys.ebi.gatling.http.Headers.Names._

import akka.util.duration._

import bootstrap._

import assertions._

import com.excilys.ebi.gatling.vtd.http.check.body.HttpBodyVtdXPathCheckBuilder._

class TheTest extends Simulation {

val tokenGen = <redacted….>

val securityToken: String = tokenGen.getToken(“redacted”)

val httpConf = httpConfig

.baseURL(“http://localhost:8080/service.wsdl”)

.acceptHeader(“text/xml, *; q=.2, /; q=.2”)

.acceptEncodingHeader(“gzip”)

.connection(“keep-alive”)

.userAgentHeader(“gatling”)

val headers_1 = Map(

“Cache-Control” → “”“no-cache”"",

“Content-Type” → “”“text/xml; charset=utf-8"”",

“Pragma” → “”“no-cache”"",

“SOAPAction” → “”"""""")

val scn = scenario("Scenario Name: Validate ")

.repeat(2) {

feed(tsv(“half-million.txt”))

.exec(http(“validate”)

.post("/")

.headers(headers_1)

.fileBody(“validateBR.txt”, Map(“k1” → “${v1}”, “k2” → “${v2}”, “k3” → “${v3}”, “k4” → “${v4}”, “k5” → “${v5}”, “k6” → securityToken))

/* .check(status.is(200)) */

.check(xpath(“SOAP:Envelope/SOAP:Body/shr:validateResponse/shr:combinedResult/shr:responseElement/shr:s/cds:sId”, List(“SOAP” → “http://schemas.xmlsoap.org/soap/envelope”, “shr” → “http://xmlns.redacted.com/s”, “cds” → “http://xmlns.redacted.com/cds/s")).saveAs("sid”))

)

}

setUp(scn.users(5).ramp(1).protocolConfig(httpConf))

}

Hi,

Looks like a bug in our ByteBufferInputStream implementation.
Could you share your SOAP message so I can reproduce, please?

Fixed: https://github.com/excilys/gatling/issues/1334

This only affects 1.5.X, not Gatling 2.
Thanks for reporting.

Will you be able to build from sources?

Cheers,

Stéphane

Hi Stéphane, I’m still having a problem for some reason. I’ll email you details (without redaction).