"java.net.ConnectException: Cannot assign requested address"

11,432 views
Skip to first unread message

Empty Account

unread,
Sep 22, 2014, 1:13:51 PM9/22/14
to gat...@googlegroups.com
Hi, 

I am running tests on a m3.xlarge (4 CPU, 15GB RAM).  

I am ramping up to 500rps for a period of 10 minutes. 

rampUsersPerSec(1) to(500) during(10.minutes) 

I have set my open-file limit to 65535

$ ulimit -n
=> 65535

But, I am still receiving  "java.net.ConnectException: Cannot assign requested address".

Do I now need to distribute my testing? 

Aidy


Stéphane Landelle

unread,
Sep 23, 2014, 4:16:33 AM9/23/14
to gat...@googlegroups.com
How long do your virtual users live?
How many open connections do you have?
How are your time wait and ephemeral port range values?

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Empty Account

unread,
Sep 23, 2014, 5:34:31 AM9/23/14
to gat...@googlegroups.com
Hi Stephane, 

I followed all the Linux tuning suggestions here: http://gatling.io/docs/2.0.0-RC3/general/operations.html - which got rid of the problem!

Many Thanks

Aidy

Stéphane Landelle

unread,
Sep 23, 2014, 5:43:47 AM9/23/14
to gat...@googlegroups.com
Great.
I thought you had already followed them, and was a bit puzzled :)

JESSICA VIDAL

unread,
Oct 9, 2015, 9:03:57 PM10/9/15
to Gatling User Group
Hi 

I got the same error. 


These are my configuration:
ulimit -n
65535
nano /proc/sys/net/ipv4/tcp_fin_timeout 
30
nano /proc/sys/net/ipv4/ip_local_port_range
32768   65535
Also I changed
> /etc/pam.d/sshd , I added session required pam_limits.so
/etc/ssh/sshd_config, I changed UseLogin yes

I am running this test on 10 machines . This should throw: 500k RPM during 5 min -> 2500000 request. 
setUp(

    test1.inject(constantUsersPerSec(833) during (500 seconds))

  ).protocols(httpConf)

What am I doing wrong? When I tried to reach 1 million is ok, but with more than 2 million gatling or the machines go down. 

Can someone help me?

Thanks in advance. 

Emanuel Hategan

unread,
Dec 18, 2015, 9:28:27 AM12/18/15
to Gatling User Group
I'm having the same issue on ubuntu 14.04. 

Just checked the OS tuning section:

$ ulimit -a
....
open files                      (-n) 65536

$ cat /proc/sys/fs/nr_open
1048576

$ cat /proc/sys/fs/file-max
1621050

session required pam_limits.so is set in all 3 files

$ cat /proc/sys/net/ipv4/tcp_fin_timeout 
60

Can you please advise?

Thank you, 
Emanuel

adrian...@hushmail.com

unread,
Dec 18, 2015, 9:51:13 AM12/18/15
to gat...@googlegroups.com
On Linux run 

ss -s 

and look at your TCP count to see if it is around your file descriptor limit.

Otherwise, the message may be from your web server (I think)!

Emanuel Hategan

unread,
Dec 18, 2015, 10:31:19 AM12/18/15
to Gatling User Group
Thank you for the quick reply. 

$ ss -s 
Total: 1087 (kernel 0)
TCP:   64775 (estab 233, closed 64510, orphaned 0, synrecv 0, timewait 64509/0), ports 0

It seems to break when it gets around 65535, however, I've now set all limits 100 times that

$ ulimit -n
6553600

$ cat  /proc/sys/fs/file-max 
6553600

$ cat /proc/sys/fs/nr_open
6553600

Since available ports for testing are between 1025 and 65535, it's probably because of that.

I'm currently having constantUsersPerSec(1000) that just make one request. 

I'm trying to make gatling recycle connections with below settings but no success so far.

allowPoolingConnections = true             # Allow pooling HTTP connections (keep-alive header automatically added)
allowPoolingSslConnections = true # Allow pooling HTTPS connections (keep-alive header automatically added)
maxConnectionsPerHost = 1000 # Max number of connections per host (-1 means no limit)
maxConnections = 1000

Can you spot anything wrong?

Thanks
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+unsubscribe@googlegroups.com.

Stéphane LANDELLE

unread,
Dec 18, 2015, 10:36:04 AM12/18/15
to gat...@googlegroups.com
Are you the one asking on SOF too? http://stackoverflow.com/questions/34355828/why-is-gatling-pausing-to-send-requests/34356777

ephemeral ports starvation

Stéphane Landelle
GatlingCorp CEO

Emanuel Hategan

unread,
Dec 18, 2015, 10:54:39 AM12/18/15
to Gatling User Group
No, I'm not...
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

adrian...@hushmail.com

unread,
Dec 18, 2015, 11:29:44 AM12/18/15
to gat...@googlegroups.com
Try .shareConnections at the protocol level. 

Stéphane LANDELLE

unread,
Dec 18, 2015, 11:35:15 AM12/18/15
to gat...@googlegroups.com
But then your connection profile will be different. Chose the one that matches your needs/live system behavior.

You can also increase your ephemeral port range and reduce your tcp time_wait.

If you have control over your network, you can also create aliases for your NI and bind from different local addresses.


Stéphane Landelle
GatlingCorp CEO


adrian...@hushmail.com

unread,
Dec 18, 2015, 12:14:48 PM12/18/15
to gat...@googlegroups.com
Yes, you must ask yourself whether a thousand users per second will hit one URL and close the connection. Other load test tools share connections which is unrealistic for browser based tests.


And you can also run off multiple machines and cat the logs. 

Emanuel Hategan

unread,
Dec 22, 2015, 10:05:47 AM12/22/15
to Gatling User Group
Thanks, that helped. Although, in the end I've ended up refactoring my tests so that a user would make multiple requests.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+unsubscribe@googlegroups.com.

Abhinav Vaid

unread,
Jun 1, 2020, 12:30:14 PM6/1/20
to Gatling User Group
Sharing connections did the trick for me!

Stéphane LANDELLE

unread,
Jun 1, 2020, 12:37:23 PM6/1/20
to gat...@googlegroups.com
shareConnections = simulating server to server traffic

If that's your use case, fine.

But if your use case is simulating web traffic, no, it didn't "make the trick".
You actually broke your test and made it meaningless.
You have to properly lift your OS limits as described in this thread and in our documentation, and if it's not enough, resort to distributed tests eg with FrontLine.

Logo Stéphane Landelle
Chief Technical Officer
twitter: @slandelle
site:
gatling.io




--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages