You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by shaoxianyang <ys...@hotmail.com> on 2009/07/29 11:54:48 UTC

java.net.BindException returned from http sampler

Hi, 

My test is simple.  Just hit one url (http://localhost:8080/appurl)  using
thread group, where there will be 1000/100 concurrent clients, and each
client loop for 2000 times. 

However, I notice that some thread fail with the following message.   What
does it mean?  I ran tomcat server and jmeter in one signle machine.  The
tomcat runs on localhost:8080.  And jmeter will connect to localhost:8080.  

I understand that web server only handle some amount of concurrent requests
at a time.  But since my server logic is quite simple.  I expect all the
request come back very quickly.  Even if it is because there is no open
connection (since all connections are serving requests), i shall see some
connection timeout, instead of binding exception.

Any thought on this?

Thanks. 


<httpSample t="3" lt="0" ts="1248859115831" s="false"
lb="HTTPRequestSampler" rc="Non HTTP response code: java.net.BindException"
rm="Non HTTP response message: Address already in use: connect"
tn="getAllCategoryGroup 1-82" dt="text" de="ISO-8859-1" by="1473" sc="1"
ec="1" ng="1" na="1" hn="DH3C8QJ1">
  <responseHeader class="java.lang.String"></responseHeader>
  <requestHeader class="java.lang.String">Connection: close
</requestHeader>
  <responseData class="java.lang.String">java.net.BindException: Address
already in use: connect&#xd;
	at java.net.PlainSocketImpl.socketConnect(Native Method)&#xd;
	at java.net.PlainSocketImpl.doConnect(Unknown Source)&#xd;
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)&#xd;
	at java.net.PlainSocketImpl.connect(Unknown Source)&#xd;
	at java.net.SocksSocketImpl.connect(Unknown Source)&#xd;
	at java.net.Socket.connect(Unknown Source)&#xd;
	at java.net.Socket.connect(Unknown Source)&#xd;
	at sun.net.NetworkClient.doConnect(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.openServer(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.openServer(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.New(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.New(Unknown Source)&#xd;
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)&#xd;
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
Source)&#xd;
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)&#xd;
	at
org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:490)&#xd;
	at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037)&#xd;
	at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1023)&#xd;
	at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:346)&#xd;
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)&#xd;
	at java.lang.Thread.run(Unknown Source)&#xd;
</responseData>
  <responseFile class="java.lang.String"></responseFile>
  <cookies class="java.lang.String"></cookies>
  <method class="java.lang.String">GET</method>
  <queryString class="java.lang.String"></queryString>
 
<java.net.URL>http://localhost:8080/TestPodCast/TestPodCastServlet?test=testAllCategory</java.net.URL>
</httpSample>
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24716020.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


RE: java.net.BindException returned from http sampler

Posted by Viswanathan Arunachalam <v....@auckland.ac.nz>.
Guys you can try different port like 9090 or 9091 it cud solve ur
problem


Regards,

Applications QA Analyst 

Information Technology Services (ITS) 

The University of Auckland, New Zealand 

Te Whare Wananga o Tamaki makaurau, Aotearoa,

(: +64 9 923 5264  *: v.arunachalam@auckland.ac.nz 

 

1883-2008: Celebrating 125 Years

 

"Om Sakti Amman Vinayaka Muruga Sastha Tunai"

P Please consider the environment before printing this email.


-----Original Message-----
From: Adrian Speteanu [mailto:asp.adieu@gmail.com] 
Sent: Wednesday, July 29, 2009 11:24 PM
To: JMeter Users List
Subject: Re: java.net.BindException returned from http sampler

I am the one that have asked this question before.
I haven't got the time to retest with the recommendations - to see if
they solve anything.

I am also unable to reproduce the bindException every time I try,
however it took me only 5 test threads to encounter this issue. So I
was also think that running out of sockets couldn't be the issue, but
without further investigation I can't say too much about this.

On Wed, Jul 29, 2009 at 2:11 PM, shaoxianyang<ys...@hotmail.com>
wrote:
>
> Hi,
>
> I have searched the forum for answer. I don't see a solid answer for
solving
> the problem.
>
> I know it is not a jmeter problem directly. The BindException also
mentions
> that the address is already used. However, I am pretty sure that other
than
> my tomcat listens on localhost:8080, it is just jmeter try to make
> connection to that port.
>
> I am not quite convinced that my machine is out of socket connection
either.
> When I connect to other website site (www.yahoo.com), in same
> load/concurrent threads, I don't get such exception. The other thing
is that
> I don't get the exception all the time, probably half the time.
>
> When i use the same load to test connection to yahoo.com, i only see a
few
> exception for "Connection time out", which is reasonable. Again, the
> percentile is so low.
>
> Now, I am not even able to reproduce the BindException any more. What
I am
> getting most of time is Connection refused. It should not happen for
about
> half of the time. It is not the same thing as "Connection time out".
The
> load i am using is 1000 threads, and each loop 20 times.
>
> java.net.ConnectException: Connection refused: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(Unknown Source)
> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> at java.net.PlainSocketImpl.connect(Unknown Source)
> at java.net.SocksSocketImpl.connect(Unknown Source)
> at java.net.Socket.connect(Unknown Source)
> at java.net.Socket.connect(Unknown Source)
> at sun.net.NetworkClient.doConnect(Unknown Source)
> at sun.net.www.http.HttpClient.openServer(Unknown Source)
> at sun.net.www.http.HttpClient.openServer(Unknown Source)
> at sun.net.www.http.HttpClient.<init>(Unknown Source)
> at sun.net.www.http.HttpClient.New(Unknown Source)
> at sun.net.www.http.HttpClient.New(Unknown Source)
> at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
> Source)
> at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
> Source)
> at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
> at
>
org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.j
ava:490)
> at
>
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSampl
erBase.java:1037)
> at
>
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSampl
erBase.java:1023)
> at
>
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java
:346)
> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
> at java.lang.Thread.run(Unknown Source)
> --
> View this message in context:
http://www.nabble.com/java.net.BindException-returned-from-http-sampler-
tp24716020p24717091.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Adrian Speteanu <as...@gmail.com>.
I am the one that have asked this question before.
I haven't got the time to retest with the recommendations - to see if
they solve anything.

I am also unable to reproduce the bindException every time I try,
however it took me only 5 test threads to encounter this issue. So I
was also think that running out of sockets couldn't be the issue, but
without further investigation I can't say too much about this.

On Wed, Jul 29, 2009 at 2:11 PM, shaoxianyang<ys...@hotmail.com> wrote:
>
> Hi,
>
> I have searched the forum for answer. I don't see a solid answer for solving
> the problem.
>
> I know it is not a jmeter problem directly. The BindException also mentions
> that the address is already used. However, I am pretty sure that other than
> my tomcat listens on localhost:8080, it is just jmeter try to make
> connection to that port.
>
> I am not quite convinced that my machine is out of socket connection either.
> When I connect to other website site (www.yahoo.com), in same
> load/concurrent threads, I don't get such exception. The other thing is that
> I don't get the exception all the time, probably half the time.
>
> When i use the same load to test connection to yahoo.com, i only see a few
> exception for "Connection time out", which is reasonable. Again, the
> percentile is so low.
>
> Now, I am not even able to reproduce the BindException any more. What I am
> getting most of time is Connection refused. It should not happen for about
> half of the time. It is not the same thing as "Connection time out". The
> load i am using is 1000 threads, and each loop 20 times.
>
> java.net.ConnectException: Connection refused: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(Unknown Source)
> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> at java.net.PlainSocketImpl.connect(Unknown Source)
> at java.net.SocksSocketImpl.connect(Unknown Source)
> at java.net.Socket.connect(Unknown Source)
> at java.net.Socket.connect(Unknown Source)
> at sun.net.NetworkClient.doConnect(Unknown Source)
> at sun.net.www.http.HttpClient.openServer(Unknown Source)
> at sun.net.www.http.HttpClient.openServer(Unknown Source)
> at sun.net.www.http.HttpClient.<init>(Unknown Source)
> at sun.net.www.http.HttpClient.New(Unknown Source)
> at sun.net.www.http.HttpClient.New(Unknown Source)
> at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
> Source)
> at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
> Source)
> at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:490)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1023)
> at
> org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:346)
> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
> at java.lang.Thread.run(Unknown Source)
> --
> View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24717091.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
Hi,
 
I have searched the forum for answer. I don't see a solid answer for solving
the problem.
 
I know it is not a jmeter problem directly. The BindException also mentions
that the address is already used. However, I am pretty sure that other than
my tomcat listens on localhost:8080, it is just jmeter try to make
connection to that port. 
 
I am not quite convinced that my machine is out of socket connection either.
When I connect to other website site (www.yahoo.com), in same
load/concurrent threads, I don't get such exception. The other thing is that
I don't get the exception all the time, probably half the time.
 
When i use the same load to test connection to yahoo.com, i only see a few
exception for "Connection time out", which is reasonable. Again, the
percentile is so low. 
 
Now, I am not even able to reproduce the BindException any more. What I am
getting most of time is Connection refused. It should not happen for about
half of the time. It is not the same thing as "Connection time out". The
load i am using is 1000 threads, and each loop 20 times. 
 
java.net.ConnectException: Connection refused: connect&#xd;
at java.net.PlainSocketImpl.socketConnect(Native Method)&#xd;
at java.net.PlainSocketImpl.doConnect(Unknown Source)&#xd;
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)&#xd;
at java.net.PlainSocketImpl.connect(Unknown Source)&#xd;
at java.net.SocksSocketImpl.connect(Unknown Source)&#xd;
at java.net.Socket.connect(Unknown Source)&#xd;
at java.net.Socket.connect(Unknown Source)&#xd;
at sun.net.NetworkClient.doConnect(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.openServer(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.openServer(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.New(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.New(Unknown Source)&#xd;
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)&#xd;
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
Source)&#xd;
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)&#xd;
at
org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:490)&#xd;
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037)&#xd;
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1023)&#xd;
at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:346)&#xd;
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)&#xd;
at java.lang.Thread.run(Unknown Source)&#xd;
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24717091.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
Hi,
 
I have searched the forum for answer. I don't see a solid answer for solving
the problem.
 
I know it is not a jmeter problem directly. The BindException also mentions
that the address is already used. However, I am pretty sure that other than
my tomcat listens on localhost:8080, it is just jmeter try to make
connection to that port. 
 
I am not quite convinced that my machine is out of socket connection either.
When I connect to other website site (www.yahoo.com), in same
load/concurrent threads, I don't get such exception. The other thing is that
I don't get the exception all the time, probably half the time.
 
When i use the same load to test connection to yahoo.com, i only see a few
exception for "Connection time out", which is reasonable. Again, the
percentile is so low. 
 
Now, I am not even able to reproduce the BindException any more. What I am
getting most of time is Connection refused. It should not happen for about
half of the time. It is not the same thing as "Connection time out". The
load i am using is 1000 threads, and each loop 20 times. 
 
java.net.ConnectException: Connection refused: connect&#xd;
at java.net.PlainSocketImpl.socketConnect(Native Method)&#xd;
at java.net.PlainSocketImpl.doConnect(Unknown Source)&#xd;
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)&#xd;
at java.net.PlainSocketImpl.connect(Unknown Source)&#xd;
at java.net.SocksSocketImpl.connect(Unknown Source)&#xd;
at java.net.Socket.connect(Unknown Source)&#xd;
at java.net.Socket.connect(Unknown Source)&#xd;
at sun.net.NetworkClient.doConnect(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.openServer(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.openServer(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.New(Unknown Source)&#xd;
at sun.net.www.http.HttpClient.New(Unknown Source)&#xd;
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)&#xd;
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
Source)&#xd;
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)&#xd;
at
org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:490)&#xd;
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037)&#xd;
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1023)&#xd;
at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:346)&#xd;
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)&#xd;
at java.lang.Thread.run(Unknown Source)&#xd;
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24717060.html
Sent from the JMeter - User mailing list archive at Nabble.com.

Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
Hi Sebb-2-2,

I just googled around.  A lot of sample code just open the connection from
URL, and getting response from there. 

public class Main {
  public static void main(String args[]) throws Exception {
    URL url = new URL("http://www.google.com");
    HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();

    InputStream inStrm = httpCon.getInputStream();
    System.out.println("\nContent at " + url);
    int ch;
    while (((ch = inStrm.read()) != -1))
      System.out.print((char) ch);
    inStrm.close();
  }
}

Are you saying URL.openConnection just goes through phase 1 (create the
connection), not phase 2(they are connected)?  Well, the code sample above
definitely covers both phases.  

That is what that code snnipet was doing.  First, it does
url.openConnection(), then set whatever parameter to that connection.  I
assume url.openConnection already completes two phases.  Are you saying that
because you are setting some property to connection, therefore, it is
important to repeat phase 2 here?

I sort of understand your point here.  Basically, it is not wrong to make
conn.connect() again if the connection already opened.  It won't try to make
a nother socket connection.  Am i getting you right?

Ok, if no problem there, what do you think I get connection refused
exception?  That exception is not come from server response.  

Thanks in advance.



Shaoxian Yang
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24728268.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by sebb <se...@gmail.com>.
On 29/07/2009, shaoxianyang <ys...@hotmail.com> wrote:
>
>  I think this might be jmeter's bug.  Here is why:

No. If it were a bug, then the HTTP Sampler would never work.

>  The exception shows
>
>  <httpSample t="1002" s="false" rc="Non HTTP response code:
>  java.net.ConnectException" rm="Non HTTP response message: Connection
>  refused: connect" tn="getAllCategoryGroup 1-508" sc="1" ec="1" ng="115"
>  na="115">
>   <responseData class="java.lang.String">java.net.ConnectException:
>  Connection refused: connect
>
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>         at java.net.PlainSocketImpl.doConnect(Unknown Source)
>         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>         at java.net.PlainSocketImpl.connect(Unknown Source)
>         at java.net.SocksSocketImpl.connect(Unknown Source)
>         at java.net.Socket.connect(Unknown Source)
>         at java.net.Socket.connect(Unknown Source)
>         at sun.net.NetworkClient.doConnect(Unknown Source)
>         at sun.net.www.http.HttpClient.openServer(Unknown Source)
>         at sun.net.www.http.HttpClient.openServer(Unknown Source)
>         at sun.net.www.http.HttpClient.<init>(Unknown Source)
>         at sun.net.www.http.HttpClient.New(Unknown Source)
>         at sun.net.www.http.HttpClient.New(Unknown Source)
>         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
>  Source)
>         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
>  Source)
>         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
>         at
>  org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:490)
>         at
>  org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037)
>         at
>  org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1023)
>         at
>  org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:346)
>         at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
>         at java.lang.Thread.run(Unknown Source)
>
>
>
> Then I check out the JMeter's code HttpSampler.java at line 490:
>
>             for (retry = 0; retry <= MAX_CONN_RETRIES; retry++) {
>                 try {
>                     conn = setupConnection(url, method, res);
>                     // Attempt the connection:
>                     savedConn = conn;
>                     conn.connect();                 (======= Line 490 =====)
>                     break;
>                 } catch (BindException e) {
>                     if (retry >= MAX_CONN_RETRIES) {
>                         log.error("Can't connect after "+retry+" retries,
>  "+e);
>                         throw e;
>                     }
>
>     protected HttpURLConnection setupConnection(URL u, String method,
>  HTTPSampleResult res) throws IOException  {
>  ...}
>
>
>  Their SetupConnection just open a HttpURLConnection, here is the exerpt:
>
>  conn = (HttpURLConnection) url.openConnection();

This does not actually establish the connection to the server.

>  conn.setRequestMethod("GET");  //whatever the http method is
>
>  This is the very high level what setupConnection is doing.  Usually,  (by my
>  limited java net programming knowledge...),  you are ready to get response,
>  but instead, in the calling method at line 490, it immediately calls
>  URLConnection.connect (out of that HttpURLConnection instance.   It is like
>  in a short time, you are making two connection out of that socket.   After
>  that logic, then it will eventually pull out the response logic.  Why is
>  that?
>


Here is the Javadoc for connect():

"Opens a communications link to the resource referenced by this URL,
if such a connection has not already been established.

If the connect method is called when the connection has already been
opened (indicated by the connected field having the value true), the
call is ignored.

URLConnection objects go through two phases: first they are created,
then they are connected. After being created, and before being
connected, various options can be specified (e.g., doInput and
UseCaches). After connecting, it is an error to try to set them.
Operations that depend on being connected, like getContentLength, will
implicitly perform the connection, if necessary"

>  I wrote a small program to simulate late, and I also get Connection refused
>  exception,  here is the code:
>
>
>  package com.sezmi.middleware.pcs.core;
>
>  import java.net.HttpURLConnection;
>  import java.net.URL;
>
>  public class HttpUrlConnectionTest {
>
>         public static void main(String[] args) {
>                 int total = 5000;
>                 ConnectionThread[] ts  = new ConnectionThread[total];
>                 for (int i=0; i<total;i++) {
>                         ts[i] = new ConnectionThread();
>                 }
>
>                 for (int i=0; i<total; i++) {
>                         ts[i].start();
>                 }
>
>                 System.out.println("all threads are done...");
>
>
>         }
>
>
>
>         public static class ConnectionThread extends Thread {
>                 public void run() {
>                         try {
>                                 URL url = new
>  URL("http://localhost:8080/TestPodCast/TestPodCastServlet?test=testAllCategory");
>                                 HttpURLConnection conn = (HttpURLConnection)url.openConnection();
>                                 conn.setRequestMethod("GET");
>                                 conn.setRequestProperty("Connection", "keep-alive");
>                                 conn.connect();    // With this line, I am getting that Connection
>  Refused exception.  Without this line, the request went ok.

But you are not using the connection, so how do you know?

>                         } catch (Exception ex) {
>                                 ex.printStackTrace();
>                         }
>
>                 }
>         }
>  }
>
>
>
>
>
>
>
>  Can someone let me know if this is truely the jmeter source problem, please
>  do explain why the second connect method call is necessary.
>
>
>  Thanks.
>
>
>
>  Shaoxian Yang
>
> --
>  View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24726791.html
>
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
my understanding of sockets is lesser than yours :) , but the connect()
establishes the socket , any operation that you do must perform a connect
(in some cases this might be implicit). So i dont think there is any bug in
JMeter code.

Your tomcat is running on the same server as the jmeter client so you have
doubled the number of open sockets and as far as I remember tomcat would
open one ServerSocket and then an additional client socket per client (or in
our case per jmeter thread) and this may be interfering or something  for
larger loads. Hence if you can temporarily run the jmeter client from some
other machine then we can eliminate this problem

Again this is pure guesswork , i do not have much of a background in socket
programming

regards
deepak

On Wed, Jul 29, 2009 at 1:58 PM, shaoxianyang <ys...@hotmail.com> wrote:

>
> Thanks.
>
> In some test run, I am getting both Connection Refused and Binding
> Exception
> (Address already used).  So you are saying binding exception case, the
> connection never even sent out?  Why is that?  That address can't be used
> by
> any other process, not that I can think of.  As I mention, server has to
> run
> at localhost:8080.  And jmeter making connection to localhost:8080.  For
> one
> port, there can be multiple socket opened.  Why will i get that exception?
> After all, I still have 50% chance not getting that exception.
>
> For connection refused, you are saying the connection has already gone to
> server for sure?  I thought if the server can't handle the so many
> concurrent exception, it will time out the connections, rather than refuse
> it.  So when will server time out connection vs refuse connection?
>
> I still think both exception link to the second call to connection.close().
> I just don't understand the why jmeter code has to have that logic.  See my
> posting above.
>
> Thanks.
>
> Shaoxian Yang
> --
> View this message in context:
> http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24727426.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
Thanks.

In some test run, I am getting both Connection Refused and Binding Exception
(Address already used).  So you are saying binding exception case, the
connection never even sent out?  Why is that?  That address can't be used by
any other process, not that I can think of.  As I mention, server has to run
at localhost:8080.  And jmeter making connection to localhost:8080.  For one
port, there can be multiple socket opened.  Why will i get that exception?   
After all, I still have 50% chance not getting that exception.  

For connection refused, you are saying the connection has already gone to
server for sure?  I thought if the server can't handle the so many
concurrent exception, it will time out the connections, rather than refuse
it.  So when will server time out connection vs refuse connection?

I still think both exception link to the second call to connection.close(). 
I just don't understand the why jmeter code has to have that logic.  See my
posting above.

Thanks.

Shaoxian Yang
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24727426.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Deepak Shetty <sh...@gmail.com>.
A connection refused can be for multiple reasons, e.g. a webserver can
refuse connections if the number of concurrent sockets passes a threshold.
Your bind exception which explicitly states that the port is in use should
be a different problem.
regards
deepak

On Wed, Jul 29, 2009 at 1:20 PM, shaoxianyang <ys...@hotmail.com> wrote:

>
> I think this might be jmeter's bug.  Here is why:
>
> The exception shows
>
> <httpSample t="1002" s="false" rc="Non HTTP response code:
> java.net.ConnectException" rm="Non HTTP response message: Connection
> refused: connect" tn="getAllCategoryGroup 1-508" sc="1" ec="1" ng="115"
> na="115">
>  <responseData class="java.lang.String">java.net.ConnectException:
> Connection refused: connect
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>        at java.net.PlainSocketImpl.doConnect(Unknown Source)
>        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>        at java.net.PlainSocketImpl.connect(Unknown Source)
>        at java.net.SocksSocketImpl.connect(Unknown Source)
>        at java.net.Socket.connect(Unknown Source)
>        at java.net.Socket.connect(Unknown Source)
>        at sun.net.NetworkClient.doConnect(Unknown Source)
>        at sun.net.www.http.HttpClient.openServer(Unknown Source)
>        at sun.net.www.http.HttpClient.openServer(Unknown Source)
>        at sun.net.www.http.HttpClient.<init>(Unknown Source)
>        at sun.net.www.http.HttpClient.New(Unknown Source)
>        at sun.net.www.http.HttpClient.New(Unknown Source)
>        at
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
> Source)
>        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
> Source)
>        at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown
> Source)
>        at
>
> org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:490)
>        at
>
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037)
>        at
>
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1023)
>        at
>
> org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:346)
>        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
>        at java.lang.Thread.run(Unknown Source)
>
>
> Then I check out the JMeter's code HttpSampler.java at line 490:
>
>            for (retry = 0; retry <= MAX_CONN_RETRIES; retry++) {
>                try {
>                    conn = setupConnection(url, method, res);
>                    // Attempt the connection:
>                    savedConn = conn;
>                    conn.connect();                 (======= Line 490 =====)
>                    break;
>                } catch (BindException e) {
>                    if (retry >= MAX_CONN_RETRIES) {
>                        log.error("Can't connect after "+retry+" retries,
> "+e);
>                        throw e;
>                    }
>
>    protected HttpURLConnection setupConnection(URL u, String method,
> HTTPSampleResult res) throws IOException  {
> ...}
>
>
> Their SetupConnection just open a HttpURLConnection, here is the exerpt:
>
> conn = (HttpURLConnection) url.openConnection();
> conn.setRequestMethod("GET");  //whatever the http method is
>
> This is the very high level what setupConnection is doing.  Usually,  (by
> my
> limited java net programming knowledge...),  you are ready to get response,
> but instead, in the calling method at line 490, it immediately calls
> URLConnection.connect (out of that HttpURLConnection instance.   It is like
> in a short time, you are making two connection out of that socket.   After
> that logic, then it will eventually pull out the response logic.  Why is
> that?
>
> I wrote a small program to simulate late, and I also get Connection refused
> exception,  here is the code:
>
>
> package com.sezmi.middleware.pcs.core;
>
> import java.net.HttpURLConnection;
> import java.net.URL;
>
> public class HttpUrlConnectionTest {
>
>        public static void main(String[] args) {
>                int total = 5000;
>                ConnectionThread[] ts  = new ConnectionThread[total];
>                for (int i=0; i<total;i++) {
>                        ts[i] = new ConnectionThread();
>                }
>
>                for (int i=0; i<total; i++) {
>                        ts[i].start();
>                }
>
>                System.out.println("all threads are done...");
>
>
>        }
>
>
>
>        public static class ConnectionThread extends Thread {
>                public void run() {
>                        try {
>                                URL url = new
> URL("
> http://localhost:8080/TestPodCast/TestPodCastServlet?test=testAllCategory
> ");
>                                HttpURLConnection conn =
> (HttpURLConnection)url.openConnection();
>                                conn.setRequestMethod("GET");
>                                conn.setRequestProperty("Connection",
> "keep-alive");
>                                conn.connect();    // With this line, I am
> getting that Connection
> Refused exception.  Without this line, the request went ok.
>
>                        } catch (Exception ex) {
>                                ex.printStackTrace();
>                        }
>
>                }
>        }
> }
>
>
>
>
>
>
>
> Can someone let me know if this is truely the jmeter source problem, please
> do explain why the second connect method call is necessary.
>
>
> Thanks.
>
>
>
> Shaoxian Yang
> --
> View this message in context:
> http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24726791.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
I think this might be jmeter's bug.  Here is why:

The exception shows 

<httpSample t="1002" s="false" rc="Non HTTP response code:
java.net.ConnectException" rm="Non HTTP response message: Connection
refused: connect" tn="getAllCategoryGroup 1-508" sc="1" ec="1" ng="115"
na="115">
  <responseData class="java.lang.String">java.net.ConnectException:
Connection refused: connect&#xd;
	at java.net.PlainSocketImpl.socketConnect(Native Method)&#xd;
	at java.net.PlainSocketImpl.doConnect(Unknown Source)&#xd;
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)&#xd;
	at java.net.PlainSocketImpl.connect(Unknown Source)&#xd;
	at java.net.SocksSocketImpl.connect(Unknown Source)&#xd;
	at java.net.Socket.connect(Unknown Source)&#xd;
	at java.net.Socket.connect(Unknown Source)&#xd;
	at sun.net.NetworkClient.doConnect(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.openServer(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.openServer(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.New(Unknown Source)&#xd;
	at sun.net.www.http.HttpClient.New(Unknown Source)&#xd;
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)&#xd;
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
Source)&#xd;
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)&#xd;
	at
org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:490)&#xd;
	at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037)&#xd;
	at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1023)&#xd;
	at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:346)&#xd;
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)&#xd;
	at java.lang.Thread.run(Unknown Source)&#xd;


Then I check out the JMeter's code HttpSampler.java at line 490:

            for (retry = 0; retry <= MAX_CONN_RETRIES; retry++) {
                try {
                    conn = setupConnection(url, method, res);
                    // Attempt the connection:
                    savedConn = conn;
                    conn.connect();                 (======= Line 490 =====)
                    break;
                } catch (BindException e) {
                    if (retry >= MAX_CONN_RETRIES) {
                        log.error("Can't connect after "+retry+" retries,
"+e);
                        throw e;
                    }

    protected HttpURLConnection setupConnection(URL u, String method,
HTTPSampleResult res) throws IOException  {
...}


Their SetupConnection just open a HttpURLConnection, here is the exerpt:

conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");  //whatever the http method is

This is the very high level what setupConnection is doing.  Usually,  (by my
limited java net programming knowledge...),  you are ready to get response,
but instead, in the calling method at line 490, it immediately calls
URLConnection.connect (out of that HttpURLConnection instance.   It is like
in a short time, you are making two connection out of that socket.   After
that logic, then it will eventually pull out the response logic.  Why is
that? 

I wrote a small program to simulate late, and I also get Connection refused
exception,  here is the code:


package com.sezmi.middleware.pcs.core;

import java.net.HttpURLConnection;
import java.net.URL;

public class HttpUrlConnectionTest {

	public static void main(String[] args) {
		int total = 5000;
		ConnectionThread[] ts  = new ConnectionThread[total];
		for (int i=0; i<total;i++) {
			ts[i] = new ConnectionThread();
		}
		
		for (int i=0; i<total; i++) {
			ts[i].start();
		}
		
		System.out.println("all threads are done...");
		
		
	}
	
	
	
	public static class ConnectionThread extends Thread {
		public void run() {
			try {
				URL url = new
URL("http://localhost:8080/TestPodCast/TestPodCastServlet?test=testAllCategory");
				HttpURLConnection conn = (HttpURLConnection)url.openConnection();
				conn.setRequestMethod("GET");
				conn.setRequestProperty("Connection", "keep-alive");
				conn.connect();    // With this line, I am getting that Connection
Refused exception.  Without this line, the request went ok.

			} catch (Exception ex) {
				ex.printStackTrace();
			}
			
		}
	}
}







Can someone let me know if this is truely the jmeter source problem, please
do explain why the second connect method call is necessary.


Thanks.



Shaoxian Yang
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24726791.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by sebb <se...@gmail.com>.
Please search the mailing list archives (follow links from the web-site).

This same question was asked and answered a month or so ago.

On 29/07/2009, shaoxianyang <ys...@hotmail.com> wrote:
>
>  Hi,
>
>  My test is simple.  Just hit one url (http://localhost:8080/appurl)  using
>  thread group, where there will be 1000/100 concurrent clients, and each
>  client loop for 2000 times.
>
>  However, I notice that some thread fail with the following message.   What
>  does it mean?  I ran tomcat server and jmeter in one signle machine.  The
>  tomcat runs on localhost:8080.  And jmeter will connect to localhost:8080.
>
>  I understand that web server only handle some amount of concurrent requests
>  at a time.  But since my server logic is quite simple.  I expect all the
>  request come back very quickly.  Even if it is because there is no open
>  connection (since all connections are serving requests), i shall see some
>  connection timeout, instead of binding exception.
>
>  Any thought on this?
>
>  Thanks.
>
>
>  <httpSample t="3" lt="0" ts="1248859115831" s="false"
>  lb="HTTPRequestSampler" rc="Non HTTP response code: java.net.BindException"
>  rm="Non HTTP response message: Address already in use: connect"
>  tn="getAllCategoryGroup 1-82" dt="text" de="ISO-8859-1" by="1473" sc="1"
>  ec="1" ng="1" na="1" hn="DH3C8QJ1">
>   <responseHeader class="java.lang.String"></responseHeader>
>   <requestHeader class="java.lang.String">Connection: close
>  </requestHeader>
>   <responseData class="java.lang.String">java.net.BindException: Address
>  already in use: connect
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>         at java.net.PlainSocketImpl.doConnect(Unknown Source)
>         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>         at java.net.PlainSocketImpl.connect(Unknown Source)
>         at java.net.SocksSocketImpl.connect(Unknown Source)
>         at java.net.Socket.connect(Unknown Source)
>         at java.net.Socket.connect(Unknown Source)
>         at sun.net.NetworkClient.doConnect(Unknown Source)
>         at sun.net.www.http.HttpClient.openServer(Unknown Source)
>         at sun.net.www.http.HttpClient.openServer(Unknown Source)
>         at sun.net.www.http.HttpClient.<init>(Unknown Source)
>         at sun.net.www.http.HttpClient.New(Unknown Source)
>         at sun.net.www.http.HttpClient.New(Unknown Source)
>         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
>  Source)
>         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
>  Source)
>         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
>         at
>  org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:490)
>         at
>  org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037)
>         at
>  org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1023)
>         at
>  org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:346)
>         at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
>         at java.lang.Thread.run(Unknown Source)
>  </responseData>
>   <responseFile class="java.lang.String"></responseFile>
>   <cookies class="java.lang.String"></cookies>
>   <method class="java.lang.String">GET</method>
>   <queryString class="java.lang.String"></queryString>
>
>  <java.net.URL>http://localhost:8080/TestPodCast/TestPodCastServlet?test=testAllCategory</java.net.URL>
>  </httpSample>
>
> --
>  View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24716020.html
>  Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Adrian Speteanu <as...@gmail.com>.
Guys,

As I mentioned before, I've reproduced this problem with only 10
threads, testing a server that wasn't on the local machine and was not
being used for anything else than the test.

Therefore, we can eliminate the fact that it takes only high loads to
reproduce the issue.

I test with jmeter 2.3.4 and the server is also a tomcat.
I have a windows vista and the application server OS is a linux (has a
database server as well). It's pretty well tuned, both it and the OS
(I am confident in the net admin that takes care of the servers).


 sebb replied to me in the other thread about this issue:
"
Perhaps add "Connection close" to some of the samplers.

Try using the HttpClient sampler instead of the default HTTP sampler.
"
He suggested unchecking the Keep-Alive option from the sampler.

I assume from this and all that you have discussed that, for some
reason, JMeter doesn't closes its connection to the server properly.
Possible causes:
1. bug (i think it would have been encountered by several other persons)
2. the way the test is configured and some weird scenarios that we encountered
3. network card problems (including deprecated drivers). I had the one
from the test machine replaced to see if there are improvements.

I have also encountered the Connection refused issue, but didn't
thought to investigate further, I just lowered the test threads to a
point where it didn't occur any more, however the bindException still
appears, and pretty often.

To disregard this error, in Summarizer, check the Successes checkbox,
to record only good samples. In my case this is the only exception
occurring, so had to use this workaround to get quick results.

On Thu, Jul 30, 2009 at 9:51 AM, Milamber<mi...@gmail.com> wrote:
> Hello,
>
> What is the operating system of the server? and Jmeter?
>
> During the test, there is possible to execute a "netstat -an" and calcule
> the number of connections between the server and the Jmeter (example:
> "netstat -an | grep 8080 | wc -l" if Tomcat's port is 8080)
>
> If server is Unix or Linux, what is the result of command "ulimit -n"?
> (default in Linux is 1024 for the number of max open files, which would
> explain the problem BindEx at 1000 ...)
>
> Bye,
> Milamber
>
>
> Le 30/07/2009 07:19, shaoxianyang a ecrit :
>>
>> Hi deepak,
>>
>> even after I move my jmeter process to another machine.  I still get the
>> mix
>> of BindException and Connection Refused.
>>
>> I set the Tomcat server to take 300 connections concurrently at any given
>> time.  I lower my load to 200, and loop (go up to) 2000.
>> Now I am not convinced why I still see the BindException.  This time, what
>> address can be the same?
>>
>> I can accept the Connection Refused error, although Tomcat is more than
>> cable of handling it (300 threads in pool to handle 200 request at any
>> given
>> time).
>> Shaoxian
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Milamber <mi...@gmail.com>.
Hello,

What is the operating system of the server? and Jmeter?

During the test, there is possible to execute a "netstat -an" and 
calcule the number of connections between the server and the Jmeter 
(example: "netstat -an | grep 8080 | wc -l" if Tomcat's port is 8080)

If server is Unix or Linux, what is the result of command "ulimit -n"?
(default in Linux is 1024 for the number of max open files, which would 
explain the problem BindEx at 1000 ...)

Bye,
Milamber


Le 30/07/2009 07:19, shaoxianyang a ecrit :
> Hi deepak,
>
> even after I move my jmeter process to another machine.  I still get the mix
> of BindException and Connection Refused.
>
> I set the Tomcat server to take 300 connections concurrently at any given
> time.  I lower my load to 200, and loop (go up to) 2000.  
>
> Now I am not convinced why I still see the BindException.  This time, what
> address can be the same?
>
> I can accept the Connection Refused error, although Tomcat is more than
> cable of handling it (300 threads in pool to handle 200 request at any given
> time). 
>
> Shaoxian
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
Hi deepak,

even after I move my jmeter process to another machine.  I still get the mix
of BindException and Connection Refused.

I set the Tomcat server to take 300 connections concurrently at any given
time.  I lower my load to 200, and loop (go up to) 2000.  

Now I am not convinced why I still see the BindException.  This time, what
address can be the same?

I can accept the Connection Refused error, although Tomcat is more than
cable of handling it (300 threads in pool to handle 200 request at any given
time). 

Shaoxian
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24732698.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Adrian Speteanu <as...@gmail.com>.
hi everybody,

sorry to reopen such an old issue, but i have remembered some
discussion threads about closed sockets and other socket issues
(mostly when testing from a Windows station) and thought to bring
something up: http://half-open.com/

on some versions of Windows, the tcpip.sys is not configured for load
testing (the configuration is good for home users, as it limits flood
possibilities and a number of other things, from what I understand).
Increasing the number of possible "half-open" connections helps with
connection closed or connection already in use issues, at least from
what I have seen. i haven't encountered the "java.net.BindException"
exceptions with the new jvm releases installed (with or without
changing the number of half-opened connections).

i've used the tool after trying these configurations, recommended by
deepak: http://publib.boulder.ibm.com/infocenter/cmgmt/v8r3m0/index.jsp?topic=/com.ibm.eclient.doc/trs40019.htm
(it's been helpful and necessary, also, but didn't eliminate all of
the issues).

if you have some more inputs on the matter...

On 7/30/09, Deepak Shetty <sh...@gmail.com> wrote:
> hi
> netstat works on windows as well. Im not sure whether you'd get better data
> with perfmon  (same dealine pressures prevent me from trying to investigate
> this properly).
>
> If you arent getting problems with 200 * 200 , and you need to simulate
> heavier loads then can you distribute your jmeter test across multiple
> machines?
>
> Someone just posted a script to load the CSV files into a table and run
> reports, you could tweak it to ignore error samples
> regards
> deepak
>
> On Thu, Jul 30, 2009 at 11:00 AM, shaoxianyang <ys...@hotmail.com> wrote:
>
>>
>> Hi,
>>
>> Both my server and client(jmeter) machines are windows xp machines.
>>
>> Deepak, how do I monitor socket in windows?  If you know?  Otherwise, I
>> guess I have to install cygwin to do the netstat (i know windows has it)
>> and
>> grep thing.
>>
>> As for max open file limit, I don't think mine has that problem, since
>> windows does not have that limit, right?
>>
>> Since I need to collect and analyze some data soon, I won't be able to
>> keep
>> tracking this.  I will only log the success result at this time.  But
>> since
>> once there is failure, the result will be deviating too much.  Shall I
>> just
>> trust the "median" out of all the result?  Obviously, that average is not
>> helping at all.  Or there is other way to get more accurate result on how
>> long each call takes?
>>
>> I will continue follow your instruction on tracking on this, once I am
>> free
>> on the current urgent task.  I will keep you guys posted.
>>
>> Thanks.
>>
>>
>>
>> Shaoxian
>> --
>> View this message in context:
>> http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24743685.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Deepak Shetty <sh...@gmail.com>.
hi
netstat works on windows as well. Im not sure whether you'd get better data
with perfmon  (same dealine pressures prevent me from trying to investigate
this properly).

If you arent getting problems with 200 * 200 , and you need to simulate
heavier loads then can you distribute your jmeter test across multiple
machines?

Someone just posted a script to load the CSV files into a table and run
reports, you could tweak it to ignore error samples
regards
deepak

On Thu, Jul 30, 2009 at 11:00 AM, shaoxianyang <ys...@hotmail.com> wrote:

>
> Hi,
>
> Both my server and client(jmeter) machines are windows xp machines.
>
> Deepak, how do I monitor socket in windows?  If you know?  Otherwise, I
> guess I have to install cygwin to do the netstat (i know windows has it)
> and
> grep thing.
>
> As for max open file limit, I don't think mine has that problem, since
> windows does not have that limit, right?
>
> Since I need to collect and analyze some data soon, I won't be able to keep
> tracking this.  I will only log the success result at this time.  But since
> once there is failure, the result will be deviating too much.  Shall I just
> trust the "median" out of all the result?  Obviously, that average is not
> helping at all.  Or there is other way to get more accurate result on how
> long each call takes?
>
> I will continue follow your instruction on tracking on this, once I am free
> on the current urgent task.  I will keep you guys posted.
>
> Thanks.
>
>
>
> Shaoxian
> --
> View this message in context:
> http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24743685.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
Hi,

Both my server and client(jmeter) machines are windows xp machines.  

Deepak, how do I monitor socket in windows?  If you know?  Otherwise, I
guess I have to install cygwin to do the netstat (i know windows has it) and
grep thing.  

As for max open file limit, I don't think mine has that problem, since
windows does not have that limit, right?

Since I need to collect and analyze some data soon, I won't be able to keep
tracking this.  I will only log the success result at this time.  But since
once there is failure, the result will be deviating too much.  Shall I just
trust the "median" out of all the result?  Obviously, that average is not
helping at all.  Or there is other way to get more accurate result on how
long each call takes?

I will continue follow your instruction on tracking on this, once I am free
on the current urgent task.  I will keep you guys posted.

Thanks.



Shaoxian
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24743685.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Adrian Speteanu <as...@gmail.com>.
On Thu, Jul 30, 2009 at 7:26 PM, Deepak Shetty<sh...@gmail.com> wrote:
> hi
> ok, I assume you've tried out the other things recommended by sebb (and i
> think emailed by adrian).
> Do you get any errors on tomcat when you start getting this error on the
> JMeter client
>
> Can you monitor the sockets on both client and server ? are there too many
> open sockets with TIME_WAIT ? There was some tuning parameter related to the
> time that you close the socket and the time that the system actually closes
> which used to affect the server .
> Googling I found this
> http://publib.boulder.ibm.com/infocenter/cmgmt/v8r3m0/index.jsp?topic=/com.ibm.eclient.doc/trs40019.htm
>
> Adrian
> Ive never seen this happen on light loads. And Im sure this problem wouldve
> been reported more often on light loads in jmeter. in which case this seems
> to be OS/machine specific problem?
Basically this is what I assume. But I haven't got the time  yet to
retest the same application / server with same client PC and there is
still a slight possibility that it might be some other problem. I'll
get back on these two threads when I do re-test.

Momentarily, I've checked if the connections started from jmeter are
closed properly ( netstat -an -o -p TCP ).
Both normal connection that ended properly or those that ended
abruptly (by any inventive means) DO CLOSE after a short period of
time.
So it is definitely not a jvm / client-os problem.
However, at the rate of the test, it is possible to run out available
connections for a large number of threads - and that would be a
test-environment issue (but it must be an exceptional case). Thanks
for the link, good to know how to do that.


>
> regards
> deepak
>
> On Wed, Jul 29, 2009 at 11:40 PM, shaoxianyang <ys...@hotmail.com> wrote:
>
>>
>> I then lower the load to 200(threads)x200(loops), no error happens.
>>
>> Then I change the setup to be 200(threads)x400(loops).  The only error is
>> BindException (Address already in use).  I don't see any connection refused
>> exception.
>>
>> Therefore, we still don't know what cause for BindException.  The log shows
>> some BindException takes long to happen, such as 3071(ms).  From how long
>> it
>> takes, it is more of exception that server throw, instead of client side
>> socket problem.
>>
>> Can anyone make comment on this?  At least that BindException.  Now I am
>> totally confused.  Changing to another host does not eliminate this
>> problem.
>>
>> Thanks.
>>
>>
>>
>> Shaoxian
>> --
>> View this message in context:
>> http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24732916.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Deepak Shetty <sh...@gmail.com>.
hi
ok, I assume you've tried out the other things recommended by sebb (and i
think emailed by adrian).
Do you get any errors on tomcat when you start getting this error on the
JMeter client

Can you monitor the sockets on both client and server ? are there too many
open sockets with TIME_WAIT ? There was some tuning parameter related to the
time that you close the socket and the time that the system actually closes
which used to affect the server .
Googling I found this
http://publib.boulder.ibm.com/infocenter/cmgmt/v8r3m0/index.jsp?topic=/com.ibm.eclient.doc/trs40019.htm

Adrian
Ive never seen this happen on light loads. And Im sure this problem wouldve
been reported more often on light loads in jmeter. in which case this seems
to be OS/machine specific problem?

regards
deepak

On Wed, Jul 29, 2009 at 11:40 PM, shaoxianyang <ys...@hotmail.com> wrote:

>
> I then lower the load to 200(threads)x200(loops), no error happens.
>
> Then I change the setup to be 200(threads)x400(loops).  The only error is
> BindException (Address already in use).  I don't see any connection refused
> exception.
>
> Therefore, we still don't know what cause for BindException.  The log shows
> some BindException takes long to happen, such as 3071(ms).  From how long
> it
> takes, it is more of exception that server throw, instead of client side
> socket problem.
>
> Can anyone make comment on this?  At least that BindException.  Now I am
> totally confused.  Changing to another host does not eliminate this
> problem.
>
> Thanks.
>
>
>
> Shaoxian
> --
> View this message in context:
> http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24732916.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
I then lower the load to 200(threads)x200(loops), no error happens.

Then I change the setup to be 200(threads)x400(loops).  The only error is
BindException (Address already in use).  I don't see any connection refused
exception.  

Therefore, we still don't know what cause for BindException.  The log shows
some BindException takes long to happen, such as 3071(ms).  From how long it
takes, it is more of exception that server throw, instead of client side
socket problem. 

Can anyone make comment on this?  At least that BindException.  Now I am
totally confused.  Changing to another host does not eliminate this problem.

Thanks.



Shaoxian
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24732916.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
ConnectionRefused might be because you have overloaded the webserver (most
have a tcp/http backlog after which they will refuse connections- Im not
sure where this setting is for tomcat). It might also happen because of
ulimit (on unix)
I'd take this as a sign that you are running too high a load. You have to
reduce the load or tune tomcat(or run a cluster of webservers) . It might
also indicate that your OS is not tuned too well.
>For the original BindException, I don't know if program loops more, will
that come back again?
I would hope not. Let us know :)

>Is there any way in jmeter to discard those error case, and only let the
aggregate statistic focus on the working ones, so that I get a good idea
about the response time?
write your own custom XSLT or SAX filter to filter out the results you dont
want from the jtl is the only way i know

regards
deepak

On Wed, Jul 29, 2009 at 2:22 PM, shaoxianyang <ys...@hotmail.com> wrote:

>
> Yeh, I did try with another machine.   Running 1000 threads and each loop
> 100
> times.
>
> Although I don't see the bindException, but I still see 10% of Connection
> RefusedException.  I am still not sure why Connection RefusedException,
> instead of Connection TimeoutException.
>
> For the original BindException, I don't know if program loops more, will
> that come back again?
>
> Is there any way in jmeter to discard those error case, and only let the
> aggregate statistic focus on the working ones, so that I get a good idea
> about the response time?
> --
> View this message in context:
> http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24727856.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
Yeh, I did try with another machine.   Running 1000 threads and each loop 100
times. 

Although I don't see the bindException, but I still see 10% of Connection
RefusedException.  I am still not sure why Connection RefusedException,
instead of Connection TimeoutException.  

For the original BindException, I don't know if program loops more, will
that come back again?

Is there any way in jmeter to discard those error case, and only let the
aggregate statistic focus on the working ones, so that I get a good idea
about the response time?
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24727856.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: java.net.BindException returned from http sampler

Posted by Deepak Shetty <sh...@gmail.com>.
hi
can you try out
a. Run your jmeter client on a separate machine than the tomcat and use the
ip address/dns name of the tomcat server in your test and do you get the
same problem?
b. if you run a netstat -p tcp without any jmeter do you see anything using
8080
c. Finally how many threads are you using? does it only happen for large
number of threads?

regards
deepak


On Wed, Jul 29, 2009 at 11:24 AM, shaoxianyang <ys...@hotmail.com> wrote:

>
> Viswanathan Arunachalam,
>
> How can I connect to another port if my server is running on
> localhost:8080?
> Are you saying having my server runs on another port, so jmeter will
> connect
> to that new port?  I will try.   But it sounds magic to me that another
> port
> can solve this problem.  8080 is only running by tomcat server, no one
> else.
> If i change it to 9090, still tomcat and jmeter is trying to listen/connect
> to it.
> --
> View this message in context:
> http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24724863.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: java.net.BindException returned from http sampler

Posted by shaoxianyang <ys...@hotmail.com>.
Viswanathan Arunachalam,

How can I connect to another port if my server is running on localhost:8080? 
Are you saying having my server runs on another port, so jmeter will connect
to that new port?  I will try.   But it sounds magic to me that another port
can solve this problem.  8080 is only running by tomcat server, no one else. 
If i change it to 9090, still tomcat and jmeter is trying to listen/connect
to it.
-- 
View this message in context: http://www.nabble.com/java.net.BindException-returned-from-http-sampler-tp24716020p24724863.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org