0 Replies Latest reply on Mar 11, 2009 6:35 AM by gaohoward

    Remoting Issue when writing failover test

    gaohoward

      I already asked Ron's help, but in case someone has direct experience with this, please give me some hint. Thanks.

      I'm writing a JBM test and got an issue with Remoting, need your help. The test is to force the client side failover to happen when the JMS connection and server node are good. To do this, I directly called JBM's client failover handler method, which is

      FailoverCommandCenter.failureDetected(Throwable reason, FailureDetector source, JMSRemotingConnection remotingConnection)

      Inside this method, the will disconnect the 'remotingConnection' and create a new one. The http transport is used. The JMSRemotingConnection is a wrapper of Remoting's Client object. The steps are

      1. starting two jboss nodes 0 and 1
      2. create a connection on node 1
      3. call failureDetected() method to failover
      4. expect the connection failed over to node 0

      However in step 3, I failed to create a new connection to node 0. The exception is 'Read timed out', stack trace:

      @CallbackPoller:10[@1415056] 17:50:21,639 ERROR [Client] 22222222222222222 error:
      org.jboss.remoting.CannotConnectException: Can not connect http client invoker. Read timed out.
      at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:369)
      at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:147)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:133)
      at org.jboss.remoting.Client.invoke(Client.java:1644)
      at org.jboss.remoting.Client.invoke(Client.java:554)
      at org.jboss.remoting.Client.getCallbacks(Client.java:1175)
      at org.jboss.remoting.callback.CallbackPoller.run(CallbackPoller.java:190)
      at org.jboss.remoting.callback.CallbackPoller$BlockingPollerThread.run(CallbackPoller.java:338)
      Caused by: java.net.SocketTimeoutException: Read timed out
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:129)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
      at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:681)
      at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:626)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:957)
      at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367)
      at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:294)
      ... 7 more

      I'm using remoting 2.2.2.SP11 with some added log my myself. The exact location where timed out happens is at HTTPClientInvoker.useHttpURLConnection():

      if (sendingData)
      {
      ....

      responseCode = conn.getResponseCode(); //this gets timed out!!!

      ......

      Another thing is if in step 3 I kill node 1 instead of calling failureDetected() directly, I got the expected failover. (I think the only differece is that in this case the caller thread of failureDetected() is from remoting (connectionValidator)).

      I have no idea where did I do wrong?