1. glassfish
  2. GLASSFISH-19299

Enterprise Application Client doesn't use RMI socket sent from server and doesn't honour RMISocketFactory.setSocketFactory()


    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s:
    • Fix Version/s: None
    • Component/s: orb
    • Labels:
    • Environment:

      Mac OS 10.6.8 Java 1.6.0_33



      (I've put what might appear as two issues together as I suspect they have a common cause.)

      I can't get an Enteprise Application Client to use a custom RMI socket either sent from the server or imposed on the client side through an RMI socket factory.

      I want to enforce a read timeout on client side RMI calls. I couldn't get any of the property-based approaches I discovered on the web to work. (Any suggestion on this would be appreciated.) So I tried the following:

      1) Created an RMI socket factory on the server side on the understanding that the server, in response to a client RMI call, will create a client RMI socket from the factory (so it matches the factory server socket) and send it to the client to use.

      in my socket factory I create client sockets with timeouts already set; this doesn't do much because, as others have discovered, the server resets the timeout after getting a client socket from the factory; to overcome this my socket factory creates client sockets that subclass Socket and defeat any attempt to change the socket timeout from the value that I set. This is set to happen whether the server calls setSoTimeout or a caller attempts to use the socket to connect while providing a timeout parameter.

      I can see from trace in the client that the server's attempts to reset the socket timeout are indeed defeated.

      Problem is either the server doesn't send a matching socket to the client or the client ignores it. Certainly the timeouts that I set don't work on the client side. The connect timeout that does operate appears to be the Glassfish default (60 seconds) not my custom 10 seconds. I don't see any trace on the client side to suggest that the client has used one of my sockets to connect to the server - I've got tracing in both connect methods. In the same Glassfish session I can see that server attempts to change the timeout being defeated so I know the socket factory is working on the server side. And the factory is in a shared code library.

      I thought briefly the problem might be SSL related. I would see the above behaviour if I were using SSL for my client RMI conversation since I haven't provided an SSL socket factory. However I'm not using SSL for RML.

      So I believe either the server isn't sending the client a socket or it is but the client is ignoring it.

      2) To force the client to use one of my sockets with timeout set I then set the RMI socket factory on the client side to be the socket factory described above. I can see from trace that the set happens. Also if I try to set the socket factory twice the second attempt fails, as it should, (it is only allowed to be set once) implying that the set is effective.

      I have tracing to show if the client uses the factory or connects via one of its generated client sockets. It doesn't.

      So I believe the client is ignoring a RMI socket factory setting. (from 2007) suggets that the client SSL RMI socket factory is or was hardcoded. Maybe this is true of the client non-SSL RMI socket factory ?


        There are no comments yet on this issue.


          • Assignee:
            Harshad Vilekar
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: