HTML parser crashed

Hello everybody.
I’m working on a script and while testing it on our testing environment I found out this exception.
Is there a way to narrow down a little the issue? Unfortunately digging in the html is not that easy (when you turn on the debugger as suggested you get a dump of the received html).
For instance it looks like there’s an issue with css (Even I’m ignoring css resources in my script).

Any suggestion?

`

2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : 16:01:36.574 [ERROR] i.g.h.f.HtmlParser - HTML parser crashed, there’s a chance your page wasn’t proper HTML, enable debug on ‘io.gatling.http.fetch’ logger to get the HTML content
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : java.lang.StringIndexOutOfBoundsException: String index out of range: 0
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at java.lang.String.charAt(Unknown Source) ~[na:1.8.0_45]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.CssParser$.trimLeft$1(CssParser.scala:52) ~[gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.CssParser$.extractUrl(CssParser.scala:96) ~[gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.CssParser$$anonfun$extractUrls$1.apply(CssParser.scala:37) ~[gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.CssParser$$anonfun$extractUrls$1.apply(CssParser.scala:35) ~[gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.collection.Iterator$$anon$11.next(Iterator.scala:370) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.collection.Iterator$$anon$11.next(Iterator.scala:370) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.collection.TraversableOnce$FlattenOps$$anon$1.hasNext(TraversableOnce.scala:449) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:369) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.collection.Iterator$class.foreach(Iterator.scala:750) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.collection.AbstractIterator.foreach(Iterator.scala:1202) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:104) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.HtmlParser$$anon$1$$anonfun$processTag$1$3.apply(HtmlParser.scala:175) ~[gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.HtmlParser$$anon$1$$anonfun$processTag$1$3.apply(HtmlParser.scala:173) ~[gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.Option.foreach(Option.scala:257) ~[scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.HtmlParser$$anon$1.processTag$1(HtmlParser.scala:173) ~[gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.HtmlParser$$anon$1.tag(HtmlParser.scala:187) ~[gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at jodd.lagarto.LagartoParser.emitTag(LagartoParser.java:2836) ~[jodd-lagarto-3.6.3.jar:3.6.3]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at jodd.lagarto.LagartoParser$12.parse(LagartoParser.java:784) ~[jodd-lagarto-3.6.3.jar:3.6.3]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at jodd.lagarto.LagartoParser.parse(LagartoParser.java:114) ~[jodd-lagarto-3.6.3.jar:3.6.3]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.HtmlParser.parseHtml(HtmlParser.scala:192) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.HtmlParser.getEmbeddedResources(HtmlParser.scala:209) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.ResourceFetcher$.inferredResourcesRequests$1(ResourceFetcher.scala:81) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.ResourceFetcher$.inferPageResources(ResourceFetcher.scala:105) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.fetch.ResourceFetcher$.resourceFetcherForFetchedPage(ResourceFetcher.scala:170) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.ahc.AsyncHandlerActor.executeNext(AsyncHandlerActor.scala:161) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.ahc.AsyncHandlerActor.logAndExecuteNext(AsyncHandlerActor.scala:190) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.ahc.AsyncHandlerActor.checkAndProceed$1(AsyncHandlerActor.scala:289) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.ahc.AsyncHandlerActor.io$gatling$http$ahc$AsyncHandlerActor$$processResponse(AsyncHandlerActor.scala:316) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$receive$1.applyOrElse(AsyncHandlerActor.scala:89) [gatling-http-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at akka.actor.Actor$class.aroundReceive(Actor.scala:465) [akka-actor_2.11-2.3.9.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at io.gatling.core.akka.BaseActor.aroundReceive(BaseActor.scala:22) [gatling-core-2.1.4.jar:2.1.4]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) [akka-actor_2.11-2.3.9.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at akka.actor.ActorCell.invoke(ActorCell.scala:487) [akka-actor_2.11-2.3.9.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254) [akka-actor_2.11-2.3.9.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at akka.dispatch.Mailbox.run(Mailbox.scala:221) [akka-actor_2.11-2.3.9.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at akka.dispatch.Mailbox.exec(Mailbox.scala:231) [akka-actor_2.11-2.3.9.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.5.jar:na]
2015-06-11 16:01:36.574 INFO 3060 — [ Thread-27] c.a.e.t.ptl.process.GatlingProcess : at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.5.jar:na]

`

Hi,

Is there a way to narrow down a little the issue?

One of you CSS files seems to contain an empty import rule.
Fixed: https://github.com/gatling/gatling/issues/2748

Even I'm ignoring css resources in my script

How do you ignore them?

You have enabled resource fetching. Are use sure you filter css from
resource fetching?

http://gatling.io/docs/2.1.6/http/http_protocol.html#resource-inferring

I’m excluding them this way:

http

.baseURL(“http://” + SERVER )
.inferHtmlResources(BlackList("""..?(js|css)(?v=([0-9]|[0-9].[0-9]))?""", “”"..(jpg|JPG|jpeg|gif|ico|png|map|PNG|woff|((t|o)tf))""","""..css.map"""), WhiteList())
.acceptHeader(“image/png,image/;q=0.8,/*;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.connection(“keep-alive”)
.contentTypeHeader(“application/x-www-form-urlencoded”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Firefox/24.0”)

That’s the right way.

There’s either a hole in your regexs, or a bug in Gatling. Could you share a reproducer, please?

unfortunately the website is not online publicly yet.
Anyway I’ll trying with the last snapshot.

Stephane, I’m having the same issue also with the last shapshot.
I don’t know if that one is updated with the last fix. Is it?

Thanks!

Please discard my last message, I’ve put the wrong file in the lib.
With the latest snapshot the issue seems solved. Thanks!

Well, the crash is fixed.
But still, I have no idea why you are fetching those css resources while you properly use resource filters.
Could you please either give me access privately, or ping me once you go public?

Thanks,