# java.io.IOException: Remotely closed

**URL:** <https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664>\
**Category:** Gatling (Open-Source)\
**Created:** [November 10, 2014, 6:08pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664 "2014-11-10T18:08:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![fugmag](https://avatars.discourse-cdn.com/v4/letter/f/d78d45/32.png) [@fugmag](https://community.gatling.io/u/fugmag)\
**Post date:** [November 10, 2014, 6:08pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/1 "2014-11-10T18:08:13Z")

</div>

I get about 19%:

`  
18:57:04.502 [WARN] i.g.h.a.AsyncHandlerActor - Request ‘request\_8’ failed: java.io.IOException: Remotely closed

`

running my simulation. It has been craeted using the Gatling recorder (Gatling 2.0.1).

Searching for this topic in Gatling User Group gives me:

[https://groups.google.com/forum/#!searchin/gatling/java.io.IOException$3A$20Remotely$20closed/gatling/xhwWNUC\_ZAk/Nfrka7gX2cwJ](https://groups.google.com/forum/#!searchin/gatling/java.io.IOException%243A%2420Remotely%2420closed/gatling/xhwWNUC_ZAk/Nfrka7gX2cwJ)

Concluding with this to be a problem with the server itself and advised to NOT set #maxRetry = 0 to maxRetry = 4, just to ‘avoid the problem’.

This post however concludes to set maxRetry=4 to solve the problem with remotely closed connections.

[https://groups.google.com/forum/#!searchin/gatling/java.io.IOException$3A$20Remotely$20closed/gatling/DISSgyzRmQE/7JstdYrsUxsJ](https://groups.google.com/forum/#!searchin/gatling/java.io.IOException%243A%2420Remotely%2420closed/gatling/DISSgyzRmQE/7JstdYrsUxsJ)

My question is, what is the correct solution to this problem with the (Remote) server closing down connections?

The site I am hitting with Gatling is a live web-site and I assume it can handle more that this:

`  
setUp(scn.inject(constantUsersPerSec(10) during (10))).protocols(httpProtocol)

`

Magnus

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 10, 2014, 6:39pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/2 "2014-11-10T18:39:11Z")

</div>

> I get about 19%:
> 
> 18:57:04.502 [WARN] i.g.h.a.AsyncHandlerActor - Request 'request\_8'  
> failed: java.io.IOException: Remotely closed
> 
> running my simulation. It has been craeted using the Gatling recorder  
> (Gatling 2.0.1).
> 
> Searching for this topic in Gatling User Group gives me:
> 
> [Redirecting to Google Groups](https://groups.google.com/forum/#!searchin/gatling/java.io.IOException$3A$20Remotely$20closed/gatling/xhwWNUC_ZAk/Nfrka7gX2cwJ)
> 
> Concluding with this to be a problem with the server itself and advised to  
> NOT set #maxRetry = 0 to maxRetry = 4, just to 'avoid the problem'.
> 
> This post however concludes to set maxRetry=4 to solve the problem with  
> remotely closed connections.

Outdated information from a one year old post.

> [Redirecting to Google Groups](https://groups.google.com/forum/#!searchin/gatling/java.io.IOException$3A$20Remotely$20closed/gatling/DISSgyzRmQE/7JstdYrsUxsJ)
> 
> My question is, what is the correct solution to this problem with the  
> (Remote) server closing down connections?
> 
> The site I am hitting with Gatling is a live web-site and I assume it can  
> handle more that this:
> 
> setUp(scn.inject(constantUsersPerSec(10) during (10))).protocols(  
> httpProtocol)

I could investigate if I could reproduce.

---

<div class="post-metadata">

**Author:** ![fugmag](https://avatars.discourse-cdn.com/v4/letter/f/d78d45/32.png) [@fugmag](https://community.gatling.io/u/fugmag)\
**Post date:** [November 10, 2014, 6:54pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/3 "2014-11-10T18:54:41Z")

</div>

Ok Stephane, my script is below and be ran as is.

`

import scala.concurrent.duration.\_

import io.gatling.core.Predef.\_  
import io.gatling.http.Predef.\_  
import io.gatling.jdbc.Predef.\_

class osloKommune extends Simulation {

val httpProtocol = http  
.baseURL(“[http://www.oslo.kommune.no](http://www.oslo.kommune.no)”)  
.inferHtmlResources(BlackList("""._.js""", “”"._.css""", “”"._.gif""", “”"._.jpeg""", “”"._.jpg""", “”"._.ico""", “”"._.woff""", “”"._.(t|o)tf""", “”"._.png"""), WhiteList())  
.acceptHeader("""image/png,image/_;q=0.8,_/_;q=0.5""")  
.acceptEncodingHeader(""“gzip, deflate”"")  
.acceptLanguageHeader(""“nb-no,nb;q=0.9,no-no;q=0.8,no;q=0.6,nn-no;q=0.5,nn;q=0.4,en-us;q=0.3,en;q=0.1"”")  
.connection(""“keep-alive”"")  
.userAgentHeader(""“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:33.0) Gecko/20100101 Firefox/33.0"”")

val headers\_0 = Map(""“Accept”"" → “”“text/html,application/xhtml+xml,application/xml;q=0.9,_/_;q=0.8"”")

val headers\_1 = Map(""“Accept”"" → “”"_/_""")

val uri1 = “”“[http://www.loop11.com/triton/time](http://www.loop11.com/triton/time)”""  
val uri2 = “”“[http://clients1.google.com/generate\_204](http://clients1.google.com/generate_204)"”"  
val uri3 = “”“[http://www.google-analytics.com/collect](http://www.google-analytics.com/collect)”""  
val uri4 = “”“[http://speech.leseweb.dk/rawfiles](http://speech.leseweb.dk/rawfiles)”""  
val uri5 = “”“[http://www.google.com/cse/cse.js](http://www.google.com/cse/cse.js)”""  
val uri6 = “”“[http://www.oslo.kommune.no](http://www.oslo.kommune.no)”""  
val uri7 = “”“[m.addthis.com](http://m.addthis.com)”""

val scn = scenario(“osloKommune”)  
.exec(http(“request\_0”)  
.get("""/""")  
.headers(headers\_0)  
.resources(http(“request\_1”)  
.get(uri5 + “”"?cx=002327373540402911597:wabn7l-txp4""")  
.headers(headers\_1),  
http(“request\_2”)  
.get(uri3 + “”"?v=1&\_v=j30&aip=1&a=1991371234&t=pageview&\_s=1&dl=http%3A%2F%2Fwww.oslo.kommune.no%2F&ul=nb-no&de=UTF-8&dt=Hovedside%20-%20Oslo%20kommune&sd=24-bit&sr=1280x800&vp=1280x615&je=1&fl=15.0%20r0&\_u=eCCAAEQjI~&jid=&cid=2139518378.1415618356&tid=UA-40971894-1&gtm=GTM-6R2R&z=1972736709"""),  
http(“request\_3”)  
.get(uri2 + “”""""),  
http(“request\_4”)  
.get(uri1 + “”"/1415644558623/3025af8955394915db3fd6446510c51cdcae0dc8/getsession""")  
.headers(headers\_1),  
http(“request\_5”)  
.get(uri4 + “”"/"""))  
.check(status.is(200)))  
.pause(2)  
.exec(http(“request\_6”)  
.get(uri3 + “”"?v=1&\_v=j30&a=1991371234&t=event&ni=1&\_s=1&dl=http%3A%2F%2Fwww.oslo.kommune.no%2F&ul=nb-no&de=UTF-8&dt=Hovedside%20-%20Oslo%20kommune&sd=24-bit&sr=1280x800&vp=1280x615&je=1&fl=15.0%20r0&ec=Interne%20lenker&ea=Klikk&el=http%3A%2F%2Fwww.oslo.kommune.no%2Fom\_oslo\_kommune%2Fbydelsoversikt%2F&\_u=eCCACEQnJ~&jid=&cid=2139518378.1415618356&tid=UA-40971894-1&gtm=GTM-6R2R&z=1852642060""")  
.resources(http(“request\_7”)  
.get(uri3 + “”"?v=1&\_v=j30&a=1991371234&t=event&ni=1&\_s=1&dl=http%3A%2F%2Fwww.oslo.kommune.no%2F&ul=nb-no&de=UTF-8&dt=Hovedside%20-%20Oslo%20kommune&sd=24-bit&sr=1280x800&vp=1280x615&je=1&fl=15.0%20r0&ec=Toppmeny&ea=Bydeler&el=Bydeler%20-%20www.oslo.kommune.no&\_u=eCCACEQnJ~&jid=&cid=2139518378.1415618356&tid=UA-40971894-1&gtm=GTM-6R2R&z=1920273329"""),  
http(“request\_8”)  
.get(uri6 + “”"/om\_oslo\_kommune/bydelsoversikt/""")  
.headers(headers\_0),  
http(“request\_9”)  
.get(uri6 + “”"/om\_oslo\_kommune/bydelsoversikt/""")  
.headers(headers\_0),  
http(“request\_10”)  
.get(uri5 + “”"?cx=002327373540402911597:wabn7l-txp4""")  
.headers(headers\_1),  
http(“request\_11”)  
.get(uri3 + “”"?v=1&\_v=j30&aip=1&a=214734363&t=pageview&\_s=1&dl=http%3A%2F%2Fwww.oslo.kommune.no%2Fom\_oslo\_kommune%2Fbydelsoversikt%2F&ul=nb-no&de=UTF-8&dt=Bydelsoversikt%20-%20Oslo%20kommune&sd=24-bit&sr=1280x800&vp=1280x615&je=1&fl=15.0%20r0&\_u=eCCAAEQjI~&jid=&cid=2139518378.1415618356&tid=UA-40971894-1&gtm=GTM-6R2R&linkid=topHoverMenu&z=1943884429"""),  
http(“request\_12”)  
.get(uri2 + “”""""),  
http(“request\_13”)  
.get(uri1 + “”"/1415644562303/3025af8955394915db3fd6446510c51cdcae0dc8/getsession""")  
.headers(headers\_1),  
http(“request\_14”)  
.get(uri4 + “”"/"""),  
http(“request\_15”)  
.get(“http://” + uri7 + “”"/live/red\_lojson/300lo.json?13vx90y&colc=1415644563063&si=546105929cdde096&uid=5457689a0d25a6c5&pub=friweb&rev=9.3&jsl=3&ln=nb&pc=men%2Ctbx&vpc=&dp=www.oslo.kommune.no&fp=om\_oslo\_kommune%2Fbydelsoversikt%2F&aa=0&of=0&uf=0&nt=cs;1,ce;1,dc;49,dclee;49,dcles;49,di;49,dl;30,dle;1,dls;1,fs;1,lee;u,les;49,ns;0,rs;1,rspe;46,rsps;1,scs;u&pd=0&irt=1&vcl=1&md=0&ct=1&tct=0&abt=0&lt=71&cdn=0&lnlc=NO&whcs=0&tl=c%3D132%2Cm%3D841%2Ci%3D855%2Cxm%3D912%2Cxp%3D923&pi=1&&rb=2&gen=100&callback=\_ate.track.hsr&mk=Oslo%20kommune%2COslo&""")  
.headers(headers\_1)))

setUp(scn.inject(constantUsersPerSec(35) during (10))).protocols(httpProtocol)  
}

`

I start the recorder (and say ‘no static resources’ ). Then I go to [http://www.oslo.kommune.no](http://www.oslo.kommune.no)  
Then I press the link ‘BYDELER’ in the top-menu.  
Then I press ‘STO and SAVE’.

The script that is generated is the one above and running it gives me

`  
19:52:40.388 [WARN] i.g.h.a.AsyncHandlerActor - Request ‘request\_9’ failed: java.io.IOException: Remotely closed

`

Magnus

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 10, 2014, 9:13pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/4 "2014-11-10T21:13:09Z")

</div>

You’re creating 350 users in 10 secs. I’m getting “Remotely closed”, but connect timeouts too, then.  
Are you sure you don’t get banned by the firewalls?

---

<div class="post-metadata">

**Author:** ![Tal\_Salman](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Tal\_Salman](https://community.gatling.io/u/Tal_Salman)\
**Post date:** [February 4, 2015, 2:57pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/5 "2015-02-04T14:57:31Z")

</div>

i also get it:

14:34:43.576 [WARN] i.g.h.a.AsyncHandlerActor - Request XXX failed: java.io.IOException: Remotely closed  
that happens when i try to do more load.  
i am checking now that there are no errors in the server side at all.  
Did you solve it?

---

<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 4, 2015, 3:08pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/6 "2015-02-04T15:08:25Z")

</div>

You don’t.  
It means that your server starts killing connections because there’s two many of them for its taste.  
But the client might be in the middle of writing a request on the other side of the socket.  
The same issue would happen with browsers, you’re just facing a limitation of your application.

---

<div class="post-metadata">

**Author:** ![Tal\_Salman](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Tal\_Salman](https://community.gatling.io/u/Tal_Salman)\
**Post date:** [February 4, 2015, 3:26pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/7 "2015-02-04T15:26:37Z")

</div>

great, that what i want to find.  
but how can i be sure and prove it? don’t i need to find any clue in the server log?  
As i hear from you, you are sure that this is the limitation of the server.

---

<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 4, 2015, 3:35pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/8 "2015-02-04T15:35:50Z")

</div>

It depends on your server, if it’s capable of logging the event of closing a connection.  
But really, that’s what happens.

---

<div class="post-metadata">

**Author:** ![Julian1](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@Julian1](https://community.gatling.io/u/Julian1)\
**Post date:** [January 11, 2016, 12:38pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/9 "2016-01-11T12:38:28Z")

</div>

Hi,

I’m experiencing the same problem. I am using 2.1.7. Remotely Closed connections start as soon as navigating the homepage with only one user. If it’s a server problem, is it right to suggest to the devs that the app needs optimization? Can you please elaborate about this error/issue further? What’s the best approach?

---

<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:** [January 13, 2016, 12:59pm UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/10 "2016-01-13T12:59:56Z")

</div>

No idea. Having this exception with one single user is highly suspicious.

---

<div class="post-metadata">

**Author:** ![Jatin\_Vaidya](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Jatin\_Vaidya](https://community.gatling.io/u/Jatin_Vaidya)\
**Post date:** [November 30, 2017, 8:58am UTC](https://community.gatling.io/t/java-io-ioexception-remotely-closed/1664/11 "2017-11-30T08:58:06Z")

</div>

One of the reasons for that error is, invoking your test endpoint with http:// instead of https://.
