Cookie not saved with load balanced request

Hi,

The cookie is not send with the request with a load balanced Tomcat setup. When i do a post or get it says the user is not logged in. What is going wrong?

Code:

`
package tomcat

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import java.util.concurrent.ThreadLocalRandom._
import java.util.Calendar
import java.text.SimpleDateFormat

class Starttomcat extends Simulation {

// HTTP Request Configuration
val httpConf = http
.baseURL(“https://example.net”)
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8”)
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7”)
.acceptEncodingHeader(“gzip, deflate, br”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36”)
.header(“X-Token”, “no-check”)
.setCookie()
.disableWarmUp

// CSV Feeders
val userFeeder = csv(“users.csv”).circular
val spaceFeeder = csv(“spaces.csv”).circular
val homePages = csv(“homePages.csv”).circular
val homePagesId = csv(“homePagesId.csv”).circular

object Auth {

var users = feed(userFeeder)

val getDashboard = exec(
http(“Request 1 — Login tomcat”)
.get("/")
.check(status.is(200))
)

.pause(5)

val login = exec(
http(“Request 2 — Authorize tomcat”)
.post("/dologin.action")
.queryParam(""“os_username”"", “${username}”)
.queryParam(""“os_password”"", “${password}”)
.check(status.is(200))
.check(regex("""""").saveAs(“authToken”))
.check(regex("""""").saveAs(“nodeId”))
)

.pause(3)

.exec(session => {
val nodeId = session.get(“nodeId”).asOption[String]
println(nodeId)
session
})

val logOut = exec(
http(“Request 15 — Log out of tomcat”)
.get("/login.action")
.queryParam(“logout”, “true”)
)
.exec(flushSessionCookies)

}

object Browse {

var space = feed(spaceFeeder)

val browseDirectory = exec(
http(“Request 3 — Get Space Directory”)
.get("/spacedirectory/view.action")
.check(status.is(200))
)

.pause(5)

val browseSpace = exec(
http(“Request 4 — Get Space Home”)
.get("/display/${space}/Welcome+to+tomcat")
.check(status.is(200))
)

.pause(5)

}

val confluenceUsers = scenario(“tomcat Users”)
.exec(Auth.users)
.repeat(8) {
exec(
Auth.getDashboard,
Auth.login,
Browse.space,
Browse.browseDirectory,
Browse.browseSpace,
Auth.logOut
)
}

// Setup Scenario based on tomcat scenario
setUp(tomcatUsers.inject(
atOnceUsers(5),
rampUsers(15) over (120 seconds),
).protocols(httpConf)
)
}
`

It doesn’t matter what i do, disable follow Redirects or whatever. Everytime I’m getting a 302 error…

Sorry, but there’s no way to investigate your problem with this information you provided.
You’d didn’t even mentioned the version fo gatling you’re using, as instructed when joining this mailing list: https://groups.google.com/forum/#!forum/gatling

Please:

  • check you’re using the latest release

  • best: provide a way for us to reproduce your issue, typically a fully functional Simulation we can run on our side

  • better than nothing: synthetic (just for the request setting the cookie and the request where the expected cookie is missing) debug logs

Dear Stephane,

Thank you for your response.

Gatling Version: 2.3.1

Everytime after a loggin Gatling failures to execute the get and post request… It looks like the sessionid or cookie is missing and not saved in the next requests…

Please, really, I can’t do anything with at least debug logs. Please lower logging level in logback.xml and provide those.