Getting "j.n.c.ClosedChannelException" error when running test for longer duration.

PFA scala file for the same


To run the test for 15 minutes, throttle was set but the test was terminated after 60-70 seconds. To achieve the below throughput added “repeat” for each scenario.
When this number was increased, got j.n.c.ClosedChannelException after few seconds through the test and all the requests failed subsequently.

reachRps(10) in (3 seconds)
,holdFor(15 minutes)))

Sample.scala (3.24 KB)

That’s a bug with your application or your infrastructure.
Your system forcefully kills connections just after they’ve been opened.
Don’t blame the messenger.

Throttle doesn’t affect test length. It just sets the amount of time you want to throttle for. You would need to either change your inject to ramp for longer:

setUp(scn.inject(constantUsersPerSec(100) during (30 minutes))).throttle(
  reachRps(100) in (10 seconds),
  holdFor(1 minute),
  holdFor(2 hours)

Or you would need to add a duration to the setup:

setUp(scn.inject(rampUsers(1000) during (20 minutes))).maxDuration(10 minutes)

Indeed. What mostly happens is that after throttle ends, all pending requests get thrown at the application and it can’t withstand such stress.