am I missing something obvious to test websockets in 2.0?

Everytime I try to use ws it just hangs completely without ever completing the test or timing out. Tried gatling-charts-highcharts-2.0.0-RC5, gatling-charts-highcharts-2.0.0-RC6. I used to use gilt websocket plugin and work well. But the gatling one is not event connecting to websocket (or failing apparently)

code:

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

class ChattingScenario extends Simulation {

val httpConf = http
.baseURL(“http://localhost:8080/rest/rest”)
.wsBaseURL(“ws://localhost:8282/chat/chat/”)
.wsReconnect
.wsMaxReconnects(3)
.disableFollowRedirect
.disableWarmUp

object WebSS {

val connect = exec(ws(“Connect WS”).open(“events/${event}/${username}?tr=websocket&Content-Type=application/json”))

val disconnect = exec(ws(“Close WS”).close)
}

val scn = scenario(“Scenario Waiting”).exec(WebSS.connect, WebSS.disconnect)

setUp(scn.inject(atOnceUsers(users))).protocols(httpConf)

}

results:

I have a very similar test and it works perfectly fine.
Do you have anything in the logs? Did you try to lower logging level to DEBUG in logback.xml?

Yup I have turned it on and is like it’s frozen I was combining it with rest call and html and it would just bypass it. This is what I see in debug mode. And there isn’t anymore log than this

Simulation bzchat.ChattingScenario started…

11:39:19.633 [INFO ] i.g.h.c.HttpProtocol - Start warm up

11:39:19.692 [DEBUG] o.j.n.c.s.n.SelectorUtil - Using select timeout of 500

11:39:19.692 [DEBUG] o.j.n.c.s.n.SelectorUtil - Epoll-bug workaround enabled = false

11:39:19.791 [DEBUG] o.j.n.c.DefaultChannelFuture - The dead lock checker in DefaultChannelFuture has been disabled as requested at your own risk.

11:39:19.871 [DEBUG] c.n.h.c.p.n.r.NettyConnectListener - Request using non cached Channel ‘[id: 0x8712334f, /127.0.0.1:52258 => goo.gl/74.125.228.229:80]’:

DefaultHttpRequest(chunked: false)

GET /pq1Xwu HTTP/1.1

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip

Connection: keep-alive

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0

Host: goo.gl

11:39:19.947 [DEBUG] c.n.h.c.p.n.h.HttpProtocol -

Request DefaultHttpRequest(chunked: false)

GET /pq1Xwu HTTP/1.1

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip

Connection: keep-alive

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0

Host: goo.gl

Response DefaultHttpResponse(chunked: false)

HTTP/1.1 301 Moved Permanently

Content-Type: text/html; charset=UTF-8

Cache-Control: no-cache, no-store, max-age=0, must-revalidate

Pragma: no-cache

Expires: Fri, 01 Jan 1990 00:00:00 GMT

Location: http://gatling.io/2.0.0-RC3-SNAPSHOT

X-Content-Type-Options: nosniff

X-Frame-Options: SAMEORIGIN

X-XSS-Protection: 1; mode=block

Server: GSE

Alternate-Protocol: 80:quic,p=0.01

Content-Encoding: gzip

Content-Length: 218

11:39:19.948 [DEBUG] c.n.h.c.p.n.c.ChannelManager - Adding key: http://goo.gl:80 for channel [id: 0x8712334f, /127.0.0.1:52258 => goo.gl/74.125.228.229:80]

11:39:19.951 [INFO ] i.g.h.c.HttpProtocol - Warm up done

11:39:19.967 [INFO ] i.g.c.c.Controller - Total number of users : 1

11:39:19.984 [INFO ] i.g.c.r.w.ConsoleDataWriter - Initializing

11:39:19.984 [INFO ] i.g.c.r.w.FileDataWriter - Initializing

11:39:19.997 [INFO ] i.g.c.r.w.ConsoleDataWriter - Initialized

11:39:20.001 [INFO ] i.g.c.r.w.FileDataWriter - Initialized

11:39:20.008 [DEBUG] i.g.c.c.Controller - Launching All Scenarios

11:39:20.020 [DEBUG] i.g.c.c.Controller - Finished Launching scenarios executions

11:39:20.020 [DEBUG] i.g.c.c.Controller - Setting up max duration

11:39:20.021 [INFO ] i.g.c.c.Controller - Start user #1031936287199740342-0

Here’s my sample (against Play websocket-chat sample):

object ChatRoom {
val Open = exec(ws(“Connect WS”).open("/room/chat?username=${id}"))
val Close = exec(ws(“Close WS”).close)
}

class ChatRoom extends Simulation {

val httpConf = http
.baseURL(“http://localhost:9000”)
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)
.wsBaseURL(“ws://localhost:9000”)
.wsReconnect
.wsMaxReconnects(3)
.disableFollowRedirect
.disableWarmUp

val scn = scenario(“WebSocket”)
.exec(session => session.set(“id”, “Steph” + session.userId))
.exec(http(“Login”).get("/room?username=${id}"))
.pause(1)
.exec(ChatRoom.Open, ChatRoom.Close)

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

As you can see, it’s almost identical to yours, assuming that you didn’t simplify your real test case when posting here and actually removed the buggy part.

I would need a reproducer…

I feel in between stupid and puzzled

I realize my problem was this line

exec(ws(“Connect WS”).open("/chat/events/${event}/${user_id}?tr=websocket&Content-Type=application/json"))

neither I had initialized event nor user_id variable. That being said, how come it wouldn’t just crash or said KO instead of just staying there doing anything?

thanks for your help

I was suspecting something like this so I tested opening the websocket with wrong parameters and I got a proper failure. Did you check with something like Charles how your system behaves in such conditions? Does it answer at all?