Ab is an error with apr_socket_recv: Connection rejected (61)

I am testing a checkbox and I am getting this error:

~>ab -n 10 -c 1 http://localhost:8090/ This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient)...apr_socket_recv: Connection reset by peer (54) Total of 2 requests completed 

The website runs on localhost: 8090 / and returns 200 OK.

I had the same problem with tomcat and the site worked fine.

What could be the problem?

+78
python apachebench eventlet
Oct 29 '11 at 12:21
source share
5 answers

I found using 127.0.0.1, not localhost:

ab -n 10 -c 1 http://127.0.0.1:8090/

Update: Maybe there is an error in ab: https://groups.google.com/forum/#!msg/nodejs/TZU5H7MdoII/yivu0d4LMaAJ

+177
Nov 13 2018-11-11T00:
source share

A new version of apache fixes the problem. Only need to restore ab.

Try downloading the latest package from http://archive.apache.org/dist/

You need to fix apache and create a new ab.

 $ wget http://archive.apache.org/dist/httpd/httpd-2.3.16-beta.tar.bz2 $ tar jxvf httpd-2.3.16-beta.tar.bz2 $ cd httpd-2.3.16-beta $ ./configure 

Just need to create ab, which is in the support folder.

 $ cd support $ make ... $ ./ab -n 10 -c 1 http://localhost:8090/ 

If your Apache is very old, install it and create it as described above.

 $ wget https://www.rtfm.ro/download/patches/ab.patch --no-check-certificate $ patch -p0 < ./ab.patch 

Done.

+12
Jan 11 '12 at 19:17
source share

add the -r option, which means "Do not exit socket reception errors." From time to time, you may change the default ulimit size. ab -r -n 10 -c 1 http://localhost:8090/

+6
Dec 28 '16 at 5:37
source share

Another related error that is still present in ab ( apache-2.4.29 ) is that it takes only the first result from getaddrinfo . This mistake is probably mentioned by JΓΌrgen Strobel in a comment . Suppose you have /etc/hosts that looks like this:

 127.0.0.1 localhost.localdomain localhost ::1 localhost.localdomain localhost 

The first result returned by getaddrinfo for localhost : ::1 . Thus ab tries to connect via IPv6 and fails. The workaround is to use 127.0.0.1 : ab -n 10 127.0.0.1/ . Or change the order of the lines. Although, in my case, it says:

 Benchmarking localhost (be patient)...apr_socket_recv: Connection refused (111) 
+1
Jan 7 '18 at 16:14
source share

There is a patch for this error, I followed the steps in this guide and it seems to work for me in Lion now.

0
Jan 05 2018-12-12T00:
source share



All Articles