# What happen when maximum duration expires

**URL:** <https://community.gatling.io/t/what-happen-when-maximum-duration-expires/2193>\
**Category:** Gatling (Open-Source)\
**Created:** [April 10, 2015, 12:45am UTC](https://community.gatling.io/t/what-happen-when-maximum-duration-expires/2193 "2015-04-10T00:45:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Bo](https://avatars.discourse-cdn.com/v4/letter/b/35a633/32.png) [@Brian\_Bo](https://community.gatling.io/u/Brian_Bo)\
**Post date:** [April 10, 2015, 12:45am UTC](https://community.gatling.io/t/what-happen-when-maximum-duration-expires/2193/1 "2015-04-10T00:45:28Z")

</div>

Hi,

I’m wondering what happen when the simulation reaches the maximum duration. ([http://gatling.io/docs/2.1.4/general/simulation\_setup.html#maximum-duration](http://gatling.io/docs/2.1.4/general/simulation_setup.html#maximum-duration))

1. If some sessions are still running when maximum duration is reached, is there a way to make a call right before the simulation finishes? (e.g. I want to make a request to log out all the users even if they are not finished)
2. Is everything properly cleaned up when maximum duration is reached? Sometimes I see akka actor message (dead letters encountered) after the maxDuration is reached. I’m wondering if I can clean them up properly.

Thanks,  
Brian

---

<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:** [April 10, 2015, 8:52am UTC](https://community.gatling.io/t/what-happen-when-maximum-duration-expires/2193/2 "2015-04-10T08:52:56Z")

</div>

> Hi,
> 
> I'm wondering what happen when the simulation reaches the maximum  
> duration. (  
> [http://gatling.io/docs/2.1.4/general/simulation\_setup.html#maximum-duration](http://gatling.io/docs/2.1.4/general/simulation_setup.html#maximum-duration)  
> )
> 
> 1. If some sessions are still running when maximum duration is reached, is  
> there a way to make a call right before the simulation finishes? (e.g. I  
> want to make a request to log out all the users even if they are not  
> finished)

No

> 2. Is everything properly cleaned up when maximum duration is reached?  
> Sometimes I see akka actor message (dead letters encountered) after the  
> maxDuration is reached. I'm wondering if I can clean them up properly.

INFO log messages. You can ignore them, or even turn it off:  
[Classic Logging • Akka Documentation](http://doc.akka.io/docs/akka/snapshot/java/logging.html).  
Resources (IO and ActorSystem are properly shut down).

---

<div class="post-metadata">

**Author:** ![Brian\_Bo](https://avatars.discourse-cdn.com/v4/letter/b/35a633/32.png) [@Brian\_Bo](https://community.gatling.io/u/Brian_Bo)\
**Post date:** [April 10, 2015, 5:36pm UTC](https://community.gatling.io/t/what-happen-when-maximum-duration-expires/2193/3 "2015-04-10T17:36:23Z")

</div>

What happen is that I have a custom feeder where it has a scala.concurrent.Channel (a FIFO queue, [http://www.scala-lang.org/api/2.11.5/index.html#scala.concurrent.Channel](http://www.scala-lang.org/api/2.11.5/index.html#scala.concurrent.Channel)) object. When the scenario needs a record from the feeder, it reads from the channel. And if the channel is empty, it will be blocked until something is available. However, if maximum duration is expired while the channel is blocked, Gatling “Simulation finished” is shown but the process is not killed.

---

<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:** [April 10, 2015, 6:29pm UTC](https://community.gatling.io/t/what-happen-when-maximum-duration-expires/2193/4 "2015-04-10T18:29:00Z")

</div>

Shut it down in an “after” block in the simulation.

---

<div class="post-metadata">

**Author:** ![Brian\_Bo](https://avatars.discourse-cdn.com/v4/letter/b/35a633/32.png) [@Brian\_Bo](https://community.gatling.io/u/Brian_Bo)\
**Post date:** [April 10, 2015, 9:12pm UTC](https://community.gatling.io/t/what-happen-when-maximum-duration-expires/2193/5 "2015-04-10T21:12:50Z")

</div>

Thank you for the suggestions, that should help. Let me looking into it.
