# exitHereIfFailed not exiting the current session in AWS

**URL:** <https://community.gatling.io/t/exithereiffailed-not-exiting-the-current-session-in-aws/2798>\
**Category:** Gatling (Open-Source)\
**Created:** [February 1, 2016, 4:31pm UTC](https://community.gatling.io/t/exithereiffailed-not-exiting-the-current-session-in-aws/2798 "2016-02-01T16:31:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suliman](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@Suliman](https://community.gatling.io/u/Suliman)\
**Post date:** [February 1, 2016, 4:31pm UTC](https://community.gatling.io/t/exithereiffailed-not-exiting-the-current-session-in-aws/2798/1 "2016-02-01T16:31:30Z")

</div>

Hello,

I have a simulation that runs for 1000 users. I have broken down my scenario/simulaton into chains. I would like to exit the  
simulation for the current session/user only if a failure had to happen to any of http requests within the chain for that user and do not  
continue the execution of remaining chains for that user but I would like the simulation to continue for the rest of users with no failures to continue.Running from my  
local machine works just fine but running same simulation from AWS instance seems not to work the same way . All chains are executed in AWS.

Example

val Chain1 =(  
pause(1)  
.group(“abc”){  
exec(http(“request1)  
.post(”"“xyz”"")  
.check(status.in(200 to 304))  
.headers(headers\_1)  
.resources(http(“request2”)  
.get(uri1 + “”“abc”"")  
.check(status.in(200 to 304))  
.headers(headers\_1),  
http(“requst3”)  
.get(uri1 + “”“blahblah”""+Common.systemtime())  
.check(status.in(200 to 304))  
.headers(headers\_2))) }  
).exitHereIfFailed

val Chain2 =(  
pause(1)  
.group(“abc”){  
exec(http(“request4)  
.post(”"“xyz”"")  
.check(status.in(200 to 304))  
.headers(headers\_1)  
.resources(http(“request5”)  
.get(uri1 + “”“abc”"")  
.check(status.in(200 to 304))  
.headers(headers\_1),  
http(“requst6”)  
.get(uri1 + “”“blahblah”""+Common.systemtime())  
.check(status.in(200 to 304))  
.headers(headers\_2))) }  
).exitHereIfFailed

val Chain2 =(  
pause(1)  
.group(“abc”){  
exec(http(“request7)  
.post(”"“xyz”"")  
.check(status.in(200 to 304))  
.headers(headers\_1)  
.resources(http(“request8”)  
.get(uri1 + “”“abc”"")  
.check(status.in(200 to 304))  
.headers(headers\_1),  
http(“requst9”)  
.get(uri1 + “”“blahblah”""+Common.systemtime())  
.check(status.in(200 to 304))  
.headers(headers\_2))) }  
).exitHereIfFailed

val scnseq = SeqChain1,Chain2,Chain3)  
val scn = scenario(“RecordedSimulation”).exec(scnseq)  
setUp(scn.inject(rampUsers(numberofusers) over (rampupby)).protocols(httpProtocol))

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [February 3, 2016, 9:24pm UTC](https://community.gatling.io/t/exithereiffailed-not-exiting-the-current-session-in-aws/2798/2 "2016-02-03T21:24:46Z")

</div>

Wrap your whole scenario content with a exitBlockOnFail: [http://gatling.io/docs/2.1.7/general/scenario.html#exitblockonfail](http://gatling.io/docs/2.1.7/general/scenario.html#exitblockonfail)

---

<div class="post-metadata">

**Author:** ![Suliman](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@Suliman](https://community.gatling.io/u/Suliman)\
**Post date:** [February 5, 2016, 2:49am UTC](https://community.gatling.io/t/exithereiffailed-not-exiting-the-current-session-in-aws/2798/3 "2016-02-05T02:49:02Z")

</div>

It worked. Thanks alot. I had another question I wanted to run an endurance test for my simulation above to run for couple days so I used REPEAT but it seems like the entire simulation ends/exits if an error occurs for one of the users. I was expecting that the scenario should continue/repeat for the remaining users.I used REPEAT as below

val scn = scenario(“RecordedSimulation”).repeat(repeatcount) {exec(scnseq)}  
setUp(scn.inject(rampUsers(customnumberofusers) over (customrampby)).protocols(httpProtocol))
