9 Replies Latest reply on Jan 5, 2009 6:52 PM by Ron Sigal

    Socket Invoker timeout

    Mohit Anchlia Novice

      Jboss 4.2:

      Question about timeout attribute of SocketInvoker as mentioned below:

      socket://${jboss.bind.address}:3873/?numberOfRetries=1&timeout=5000

      What does timeout 5000 mean? Does it mean the time to get the remote socket connection? Or does it mean after the connection is made then how long to wait for server response?

        • 1. Re: Socket Invoker timeout
          Ron Sigal Master

           

          mohitanchlia" wrote:

          What does timeout 5000 mean?


          On the server side, an "active" worker thread (one not in the thread pool waiting to get reused) waits in a socket read() for the next invocation. It will time out after 5 seconds and the worker thread will return itself to the thread pool.

          On the client side, the invoker enters read() to get the answer to an invocation. It will time out after 5 seconds, close the connection, and throw an exception.

          The call to java.net.Socket.connect(SocketAddress endpoint), which is the overloaded version of connect() used in org.jboss.remoting.transport.socket.MicroSocketClientInvoker, does not time out.

          • 2. Re: Socket Invoker timeout
            Mohit Anchlia Novice

             

            The call to java.net.Socket.connect(SocketAddress endpoint), which is the overloaded version of connect() used in org.jboss.remoting.transport.socket.MicroSocketClientInvoker, does not time out.


            I didn't understand the above "does not timeout". With what you described then I shouldn't be seeing this:

            2008-12-31 17:20:14,297 DEBUG [transport.socket.MicroSocketClientInvoker:ajp-0.0.0.0-8009-99] - SocketClientInvoker[18b118, socket://10.10.8.77:3873] got Exception java.net.NoRouteToHostException: No route to host, creation attempt took 5001 ms

            --

            5001 ms corresponds to 5 sec timeout set by me. Why would MicroSocketClientInvoker timeout when 5 sec timeout is really set for "read" requests made by client invoker to server invoker?

            • 3. Re: Socket Invoker timeout
              Ron Sigal Master

               

              "mohitanchlia" wrote:


              The call to java.net.Socket.connect(SocketAddress endpoint), which is the overloaded version of connect() used in org.jboss.remoting.transport.socket.MicroSocketClientInvoker, does not time out.


              I didn't understand the above "does not timeout". With what you described then I shouldn't be seeing this:

              2008-12-31 17:20:14,297 DEBUG [transport.socket.MicroSocketClientInvoker:ajp-0.0.0.0-8009-99] - SocketClientInvoker[18b118, socket://10.10.8.77:3873] got Exception java.net.NoRouteToHostException: No route to host, creation attempt took 5001 ms


              The java.net.NoRouteToHostException doesn't represent a timeout. The "creation attempt took 5001 ms" message is just extra information provided by the invoker.

              • 4. Re: Socket Invoker timeout
                Mohit Anchlia Novice

                 


                The java.net.NoRouteToHostException doesn't represent a timeout. The "creation attempt took 5001 ms" message is just extra information provided by the invoker.


                So does it really mean that timeout is on initial Socket connection creation and not on the read operation?

                • 5. Re: Socket Invoker timeout
                  Ron Sigal Master

                   

                  "mohitanchlia" wrote:



                  The java.net.NoRouteToHostException doesn't represent a timeout. The "creation attempt took 5001 ms" message is just extra information provided by the invoker.


                  So does it really mean that timeout is on initial Socket connection creation and not on the read operation?


                  Well,

                  1. The timeout is configured for the read() operation, not the connect() operation.

                  2. The java.net.NoRouteToHostException is being thrown from the connect() operation.

                  • 6. Re: Socket Invoker timeout
                    Mohit Anchlia Novice

                    Reason I have been asking same question is because below timeout corresponds to the timeout I have set in timeout attribute. If that timeout was for read operation then why would NoRouteToHostException return in the timeout that I have specified. As you mentioned NoRouteToHostException occurs during connect. Everytime NoRouteToHostException occurs it returns in the timeout I specify. So If I change my timeout to 4000 ms then I see that too.

                    The java.net.NoRouteToHostException doesn't represent a timeout. The "creation attempt took 5001 ms" message is just extra information provided by the invoker.

                    • 7. Re: Socket Invoker timeout
                      Ron Sigal Master

                       

                      "mohitanchlia" wrote:

                      Reason I have been asking same question is because below timeout corresponds to the timeout I have set in timeout attribute.


                      My mistake, again. org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket() overrides MicroSocketClientInvoker.createSocket(), and the former uses the configured timeout for the Socket.connect() call. You're right!

                      • 8. Re: Socket Invoker timeout
                        Mohit Anchlia Novice

                         

                        org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket() overrides MicroSocketClientInvoker.createSocket(), and the former uses the configured timeout for the Socket.connect() call


                        Just so I am clear, same timeout is used for both connect and read operation. So it means if I specify 5 sec that will in fact set same timeout for how long it takes to connect and also how long it takes for the client invoker to get the response from server invoker?

                        • 9. Re: Socket Invoker timeout
                          Ron Sigal Master

                           

                          "mohitanchlia" wrote:

                          Just so I am clear, same timeout is used for both connect and read operation. So it means if I specify 5 sec that will in fact set same timeout for how long it takes to connect and also how long it takes for the client invoker to get the response from server invoker?


                          That's correct.