You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org> on 2011/03/16 12:55:29 UTC

[jira] Created: (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Tuscany 1.6 RMI bug: ConnectException after component restart
-------------------------------------------------------------

                 Key: TUSCANY-3850
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Misc Binding Extensions
    Affects Versions: Java-SCA-1.6.1
         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
            Reporter: Sebastian Millies


When I have a network of components connected by RMI references, 
then restarting a component will cause a java.net.ConnectException
in all dependent components on the next remote method call.
I suspect some kind of connection factory caches out-of-date information.

Example:
ServerComponent exposes service "Server" with an RMI binding on port 8777.
ClientComponent exposes service "Client" with an RMI binding on port 8666
and has a reference to the service "Server".
ClientTest is a non-SCA Java class that exercises the Client service over RMI.

Everything works fine until the ServerComponent Java process is stopped
and re-started. The tester will then fail, because the client cannot
re-establish the connection to the server.

I attach a zip-file with the example. Steps to reproduce the problem:
Run ServerLauncher
Run ClientLauncher
Run ClientTest
Stop process in which server is running
Re-Run ServerLauncher
Re-Run ClientTest


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Millies updated TUSCANY-3850:
---------------------------------------

    Attachment: RMIReferenceInvoker.zip

Patch for this bug

> Tuscany 1.6 RMI bug: ConnectException after component restart
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3850
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Misc Binding Extensions
>    Affects Versions: Java-SCA-1.6.1
>         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
>            Reporter: Sebastian Millies
>         Attachments: RMIReferenceInvoker.zip, TuscanyRMI.zip
>
>
> When I have a network of components connected by RMI references, 
> then restarting a component will cause a java.net.ConnectException
> in all dependent components on the next remote method call.
> I suspect some kind of connection factory caches out-of-date information.
> Example:
> ServerComponent exposes service "Server" with an RMI binding on port 8777.
> ClientComponent exposes service "Client" with an RMI binding on port 8666
> and has a reference to the service "Server".
> ClientTest is a non-SCA Java class that exercises the Client service over RMI.
> Everything works fine until the ServerComponent Java process is stopped
> and re-started. The tester will then fail, because the client cannot
> re-establish the connection to the server.
> I attach a zip-file with the example. Steps to reproduce the problem:
> Run ServerLauncher
> Run ClientLauncher
> Run ClientTest
> Stop process in which server is running
> Re-Run ServerLauncher
> Re-Run ClientTest

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Millies updated TUSCANY-3850:
---------------------------------------

    Patch Info: [Patch Available]

> Tuscany 1.6 RMI bug: ConnectException after component restart
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3850
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Misc Binding Extensions
>    Affects Versions: Java-SCA-1.6.1
>         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
>            Reporter: Sebastian Millies
>         Attachments: RMIReferenceInvoker.zip, TuscanyRMI.zip
>
>
> When I have a network of components connected by RMI references, 
> then restarting a component will cause a java.net.ConnectException
> in all dependent components on the next remote method call.
> I suspect some kind of connection factory caches out-of-date information.
> Example:
> ServerComponent exposes service "Server" with an RMI binding on port 8777.
> ClientComponent exposes service "Client" with an RMI binding on port 8666
> and has a reference to the service "Server".
> ClientTest is a non-SCA Java class that exercises the Client service over RMI.
> Everything works fine until the ServerComponent Java process is stopped
> and re-started. The tester will then fail, because the client cannot
> re-establish the connection to the server.
> I attach a zip-file with the example. Steps to reproduce the problem:
> Run ServerLauncher
> Run ClientLauncher
> Run ClientTest
> Stop process in which server is running
> Re-Run ServerLauncher
> Re-Run ClientTest

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007436#comment-13007436 ] 

Sebastian Millies commented on TUSCANY-3850:
--------------------------------------------

fzhong commented on March 16, 2011, on user@tuscany.apache.org:

Hi all,
I had encountered this problem,In fact,the implementation of RMI references is simple,it lacked the capacity to respond to some exception.The Spring rmi client is a good job(org\springframework\remoting\rmi\RmiProxyFactoryBean,you can find more details in class RmiClientInterceptor),it provides a refreshStubOnConnectFailure property,that indicate  whether to refresh the RMI stub on connect failure. (If a cached RMI stub throws an RMI exception that indicates a remote connect failure, a fresh proxy will be fetched and the invocation will be retried.) The lookupStubOnStartup and cacheStub are also helpful properties,you can learn more from the spring source code.
 
Need of special note is if we use the spring rmi client to connect the rim service that is exposed by Tuscany RMI Service,although,the property refreshStubOnConnectFailure of RmiProxyFactoryBean class set to be true,we will still encounter an exception.
You should modify  invoke method of the RmiClientInterceptor class to do with UndeclaredThrowableException,
Details is :
 
public Object invoke(MethodInvocation invocation) throws Throwable {
Remote stub = getStub();
try {
return doInvoke(invocation, stub);
} catch (RemoteConnectFailureException ex) {
return handleRemoteConnectFailure(invocation, ex);
} catch (RemoteException ex) {
if (isConnectFailure(ex)) {
return handleRemoteConnectFailure(invocation, ex);
} else {
throw ex;
}
} catch (UndeclaredThrowableException ex) {// 
return handleRemoteConnectFailure(invocation, ex);
}
}
 
The tuscany rmi service and reference may some improvement,Spring related implementation is a good reference .Thank you 
2011-03-16 
________________________________________
fzhong 


> Tuscany 1.6 RMI bug: ConnectException after component restart
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3850
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Misc Binding Extensions
>    Affects Versions: Java-SCA-1.6.1
>         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
>            Reporter: Sebastian Millies
>         Attachments: TuscanyRMI.zip
>
>
> When I have a network of components connected by RMI references, 
> then restarting a component will cause a java.net.ConnectException
> in all dependent components on the next remote method call.
> I suspect some kind of connection factory caches out-of-date information.
> Example:
> ServerComponent exposes service "Server" with an RMI binding on port 8777.
> ClientComponent exposes service "Client" with an RMI binding on port 8666
> and has a reference to the service "Server".
> ClientTest is a non-SCA Java class that exercises the Client service over RMI.
> Everything works fine until the ServerComponent Java process is stopped
> and re-started. The tester will then fail, because the client cannot
> re-establish the connection to the server.
> I attach a zip-file with the example. Steps to reproduce the problem:
> Run ServerLauncher
> Run ClientLauncher
> Run ClientTest
> Stop process in which server is running
> Re-Run ServerLauncher
> Re-Run ClientTest

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Posted by "ant elder (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010025#comment-13010025 ] 

ant elder commented on TUSCANY-3850:
------------------------------------

Thanks for the patch Sebastian, i'll go look at getting it applied.

> Tuscany 1.6 RMI bug: ConnectException after component restart
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3850
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Misc Binding Extensions
>    Affects Versions: Java-SCA-1.6.1
>         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
>            Reporter: Sebastian Millies
>         Attachments: RMIReferenceInvoker.zip, TuscanyRMI.zip
>
>
> When I have a network of components connected by RMI references, 
> then restarting a component will cause a java.net.ConnectException
> in all dependent components on the next remote method call.
> I suspect some kind of connection factory caches out-of-date information.
> Example:
> ServerComponent exposes service "Server" with an RMI binding on port 8777.
> ClientComponent exposes service "Client" with an RMI binding on port 8666
> and has a reference to the service "Server".
> ClientTest is a non-SCA Java class that exercises the Client service over RMI.
> Everything works fine until the ServerComponent Java process is stopped
> and re-started. The tester will then fail, because the client cannot
> re-establish the connection to the server.
> I attach a zip-file with the example. Steps to reproduce the problem:
> Run ServerLauncher
> Run ClientLauncher
> Run ClientTest
> Stop process in which server is running
> Re-Run ServerLauncher
> Re-Run ClientTest

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Posted by "ant elder (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ant elder updated TUSCANY-3850:
-------------------------------

    Fix Version/s: Java-SCA-1.x

> Tuscany 1.6 RMI bug: ConnectException after component restart
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3850
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Misc Binding Extensions
>    Affects Versions: Java-SCA-1.6.1
>         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
>            Reporter: Sebastian Millies
>             Fix For: Java-SCA-1.x
>
>         Attachments: RMIReferenceInvoker.zip, TuscanyRMI.zip
>
>
> When I have a network of components connected by RMI references, 
> then restarting a component will cause a java.net.ConnectException
> in all dependent components on the next remote method call.
> I suspect some kind of connection factory caches out-of-date information.
> Example:
> ServerComponent exposes service "Server" with an RMI binding on port 8777.
> ClientComponent exposes service "Client" with an RMI binding on port 8666
> and has a reference to the service "Server".
> ClientTest is a non-SCA Java class that exercises the Client service over RMI.
> Everything works fine until the ServerComponent Java process is stopped
> and re-started. The tester will then fail, because the client cannot
> re-establish the connection to the server.
> I attach a zip-file with the example. Steps to reproduce the problem:
> Run ServerLauncher
> Run ClientLauncher
> Run ClientTest
> Stop process in which server is running
> Re-Run ServerLauncher
> Re-Run ClientTest

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Posted by "ant elder (Closed) (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ant elder closed TUSCANY-3850.
------------------------------

    Resolution: Fixed

Patch applied to 1.x and 2.x streams, thanks for the fix Sebastian.
                
> Tuscany 1.6 RMI bug: ConnectException after component restart
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3850
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Misc Binding Extensions
>    Affects Versions: Java-SCA-1.6.1
>         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
>            Reporter: Sebastian Millies
>             Fix For: Java-SCA-1.x
>
>         Attachments: RMIReferenceInvoker.zip, TuscanyRMI.zip
>
>
> When I have a network of components connected by RMI references, 
> then restarting a component will cause a java.net.ConnectException
> in all dependent components on the next remote method call.
> I suspect some kind of connection factory caches out-of-date information.
> Example:
> ServerComponent exposes service "Server" with an RMI binding on port 8777.
> ClientComponent exposes service "Client" with an RMI binding on port 8666
> and has a reference to the service "Server".
> ClientTest is a non-SCA Java class that exercises the Client service over RMI.
> Everything works fine until the ServerComponent Java process is stopped
> and re-started. The tester will then fail, because the client cannot
> re-establish the connection to the server.
> I attach a zip-file with the example. Steps to reproduce the problem:
> Run ServerLauncher
> Run ClientLauncher
> Run ClientTest
> Stop process in which server is running
> Re-Run ServerLauncher
> Re-Run ClientTest

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Millies updated TUSCANY-3850:
---------------------------------------

    Attachment: TuscanyRMI.zip

Testcase

> Tuscany 1.6 RMI bug: ConnectException after component restart
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3850
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Misc Binding Extensions
>    Affects Versions: Java-SCA-1.6.1
>         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
>            Reporter: Sebastian Millies
>         Attachments: TuscanyRMI.zip
>
>
> When I have a network of components connected by RMI references, 
> then restarting a component will cause a java.net.ConnectException
> in all dependent components on the next remote method call.
> I suspect some kind of connection factory caches out-of-date information.
> Example:
> ServerComponent exposes service "Server" with an RMI binding on port 8777.
> ClientComponent exposes service "Client" with an RMI binding on port 8666
> and has a reference to the service "Server".
> ClientTest is a non-SCA Java class that exercises the Client service over RMI.
> Everything works fine until the ServerComponent Java process is stopped
> and re-started. The tester will then fail, because the client cannot
> re-establish the connection to the server.
> I attach a zip-file with the example. Steps to reproduce the problem:
> Run ServerLauncher
> Run ClientLauncher
> Run ClientTest
> Stop process in which server is running
> Re-Run ServerLauncher
> Re-Run ClientTest

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (TUSCANY-3850) Tuscany 1.6 RMI bug: ConnectException after component restart

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13008901#comment-13008901 ] 

Sebastian Millies commented on TUSCANY-3850:
--------------------------------------------

The problem is in method org.apache.tuscany.sca.binding.rmi.provider.RMIReferenceInvoker#invokeTarget(Object).
The method lazily instantiates a proxy (remote stub) and never refershes it.
I have added some exception handling along the lines suggested by the 
Spring RMI client implementation. The code catches InvocationTargetException,
calls rmiHost.findService() if this exception is thrown with java.rmi.ConnectionException 
as the embedded cause, and then retries the remoteMethod.invoke() call.

I have attached a zip file that contains both a patch created with Tortoise SVN
plus the entire RMIReferenceInvoker.java source file.

-- Sebastian

> Tuscany 1.6 RMI bug: ConnectException after component restart
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3850
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3850
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Misc Binding Extensions
>    Affects Versions: Java-SCA-1.6.1
>         Environment: Java 1.6.0_24, Eclipse Helios, Win XP SP3
>            Reporter: Sebastian Millies
>         Attachments: RMIReferenceInvoker.zip, TuscanyRMI.zip
>
>
> When I have a network of components connected by RMI references, 
> then restarting a component will cause a java.net.ConnectException
> in all dependent components on the next remote method call.
> I suspect some kind of connection factory caches out-of-date information.
> Example:
> ServerComponent exposes service "Server" with an RMI binding on port 8777.
> ClientComponent exposes service "Client" with an RMI binding on port 8666
> and has a reference to the service "Server".
> ClientTest is a non-SCA Java class that exercises the Client service over RMI.
> Everything works fine until the ServerComponent Java process is stopped
> and re-started. The tester will then fail, because the client cannot
> re-establish the connection to the server.
> I attach a zip-file with the example. Steps to reproduce the problem:
> Run ServerLauncher
> Run ClientLauncher
> Run ClientTest
> Stop process in which server is running
> Re-Run ServerLauncher
> Re-Run ClientTest

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira