No attribute named '<session-vairable>' is defined post facing 5xx,4xx errors


I’m trying to run a soak test with the below simulation. The problem that I’m facing is that after some time, the system receives the following error :, but actually found 504, but actually found 500, but actually found 408

post the introduction of the above errors, my simulation started logging errors due to : no attribute named ‘csrfToken’ is defined

var scn: ScenarioBuilder = scenario(“Soak Test”)
.pause(1 second, 10 seconds)
.during (1 hour) (
.pause(1 second, 10 seconds)
.pause(1 second, 10 seconds)
.pause(1 second, 10 seconds)
.pause(1 second, 10 seconds)
.pause(5 seconds, 10 seconds)

the csrfToken is being extracted from the Auth :

val auth: ChainBuilder = feed(Config.csvFeeder)
.header(“content-type”, “application/x-www-form-urlencoded”)
.header(“user-agent”, “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36”)

val one: ChainBuilder = exec(http("/endpoint")
.header(“x-csrf-token”, “${csrfToken}”)

Wanted to understand why is the simulation unable to find the variable which was working fine previously before the introduction of these errors


Bumping this thread as I’m still unable to figure out what is going wrong with the setup. Is it that the session variable is loosing the stored keys when the previous http request is failing?

Thanks in advance,

What does your injection profile look like?

I’d say that this no attribute named 'csrfToken' is defined happens for newly injected users who were never able to capture it as “/ui/auth” failed with 408/500/504 for them.

Hi Stéphane,

The injection profile is a simple one. Its rampUsers(1800) during (300 seconds).

This does looks like what you’ve mentioned happened when a newly injected user fails in the errors. Is there any way to mitigate those users?

Well, Gatling is only the messenger here. The core issue is that your
application can't withstand the load you're throwing at it and those users
don't fail. Investigate your performance issues and fix them, or decide
your performance target is too high.