Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proactive.hostname does not work on a NAT environment #547

Closed
activeeon-bot opened this issue May 14, 2009 · 4 comments
Closed

proactive.hostname does not work on a NAT environment #547

activeeon-bot opened this issue May 14, 2009 · 4 comments

Comments

@activeeon-bot
Copy link

Original issue created by Florin Bratu on 14, May 2009 at 20:04 PM - PROACTIVE-666


I have an active object that runs on a remote host, and a machine which is behind a router that uses NAT. I am trying to lookup the active object from the local machine and execute a method on it. ProActive fails to work on this configuration:

  1. If I don't use proactive.hostname, then the "internal" address 192.168.0.4 will be elected. See 2

  2. If I set -Dproactive.hostname=192.168.0.4, then on the remote host the active object will process the method, but when it wants to send back the reply it reports the following exception:
    (link: AO.BodyImpl$ActiveLocalBodyStrategy.serveInternal) Connection refused to host: 192.168.0.4; nested exception is:
    java.net.ConnectException: Connection timed out
    java.rmi.ConnectException: Connection refused to host: 192.168.0.4; nested exception is:
    java.net.ConnectException: Connection timed out
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
    at org.objectweb.proactive.core.remoteobject.rmi.RmiRemoteObjectImpl_Stub.receiveMessage(Unknown Source)
    at org.objectweb.proactive.core.remoteobject.RemoteObjectAdapter.receiveMessage(RemoteObjectAdapter.java:169)
    at org.objectweb.proactive.core.remoteobject.SynchronousProxy.reify(SynchronousProxy.java:77)
    at pa.stub.org.objectweb.proactive.core.body._StubUniversalBody.receiveReply(_StubUniversalBody.java)
    at org.objectweb.proactive.core.body.UniversalBodyRemoteObjectAdapter.receiveReply(UniversalBodyRemoteObjectAdapter.java:173)
    at org.objectweb.proactive.core.body.reply.ReplyImpl.send(ReplyImpl.java:150)
    at org.objectweb.proactive.core.body.BodyImpl$ActiveLocalBodyStrategy.serveInternal(BodyImpl.java:621)
    at org.objectweb.proactive.core.body.BodyImpl$ActiveLocalBodyStrategy.serve(BodyImpl.java:525)
    at org.objectweb.proactive.core.body.AbstractBody.serve(AbstractBody.java:922)
    at org.objectweb.proactive.Service.blockingServeOldest(Service.java:175)
    at org.objectweb.proactive.Service.blockingServeOldest(Service.java:150)
    at org.objectweb.proactive.Service.fifoServing(Service.java:126)
    at org.objectweb.proactive.core.body.ActiveBody$FIFORunActive.runActivity(ActiveBody.java:317)
    at org.objectweb.proactive.core.body.ActiveBody.run(ActiveBody.java:197)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.net.ConnectException: Connection timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:518)
    at java.net.Socket.connect(Socket.java:468)
    at java.net.Socket.(Socket.java:365)
    at java.net.Socket.(Socket.java:179)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
    ... 18 more
    This is normal: 192.168.0.4 is not visible outside...

  3. If I set -Dproactive.hostname=(link: router_IP), then the RMI registry created by ProActive is unable to do object bindings:
    (link: DEBUG oactive.remoteobject AbstractRmiRemoteObjectFactory) cannot bind object at rmi://(link: router_IP)8080/PA_JVM1899355203
    org.objectweb.proactive.core.ProActiveException: Failed to create remote object (name=PA_JVM1899355203)
    at org.objectweb.proactive.core.remoteobject.RemoteObjectExposer.createRemoteObject(RemoteObjectExposer.java:160)
    at org.objectweb.proactive.core.runtime.ProActiveRuntimeImpl.(ProActiveRuntimeImpl.java:274)
    at org.objectweb.proactive.core.runtime.ProActiveRuntimeImpl.(ProActiveRuntimeImpl.java:163)
    at org.objectweb.proactive.core.remoteobject.AbstractRemoteObjectFactory.addCodebase(AbstractRemoteObjectFactory.java:64)
    at org.objectweb.proactive.core.remoteobject.AbstractRemoteObjectFactory.createClassServer(AbstractRemoteObjectFactory.java:83)
    at org.objectweb.proactive.core.remoteobject.AbstractRemoteObjectFactory.(AbstractRemoteObjectFactory.java:52)
    at org.objectweb.proactive.core.remoteobject.RemoteObjectHelper.getRemoteObjectFactory(RemoteObjectHelper.java:110)
    at org.objectweb.proactive.core.remoteobject.RemoteObjectHelper.getFactoryFromURL(RemoteObjectHelper.java:120)
    at org.objectweb.proactive.core.remoteobject.RemoteObjectHelper.lookup(RemoteObjectHelper.java:161)
    at org.objectweb.proactive.api.PAActiveObject.lookupActive(PAActiveObject.java:1244)
    at org.ow2.proactive.authentication.Connection.lookupAuthentication(Connection.java:86)
    at org.ow2.proactive.authentication.Connection.connect(Connection.java:97)
    at org.ow2.proactive.resourcemanager.frontend.RMConnection.join(RMConnection.java:84)
    at org.ow2.proactive.resourcemanager.gui.data.RMStore.(RMStore.java:93)
    at org.ow2.proactive.resourcemanager.gui.data.RMStore.newInstance(RMStore.java:132)
    at org.ow2.proactive.resourcemanager.gui.handlers.ConnectHandler.execute(ConnectHandler.java:69)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:281)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
    at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
    at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247)
    at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247)
    at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:619)
    at org.eclipse.ui.menus.CommandContributionItem.access$10(CommandContributionItem.java:605)
    at org.eclipse.ui.menus.CommandContributionItem$4.handleEvent(CommandContributionItem.java:595)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1158)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3401)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3033)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.ow2.proactive.resourcemanager.Application.start(Application.java:59)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
    Caused by: org.objectweb.proactive.core.ProActiveException: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.AccessException: Registry.Registry.rebind disallowed; origin /192.168.0.254 is non-local host
    at org.objectweb.proactive.core.remoteobject.rmi.AbstractRmiRemoteObjectFactory.register(AbstractRmiRemoteObjectFactory.java:176)
    at org.objectweb.proactive.core.remoteobject.rmi.AbstractRmiRemoteObjectFactory.createRemoteObject(AbstractRmiRemoteObjectFactory.java:263)
    at org.objectweb.proactive.core.remoteobject.RemoteObjectExposer.createRemoteObject(RemoteObjectExposer.java:156)
    ... 49 more
    Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.AccessException: Registry.Registry.rebind disallowed; origin /192.168.0.254 is non-local host
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Naming.java:160)
    at org.objectweb.proactive.core.remoteobject.rmi.AbstractRmiRemoteObjectFactory.register(AbstractRmiRemoteObjectFactory.java:164)
    ... 51 more
    Caused by: java.rmi.AccessException: Registry.Registry.rebind disallowed; origin /192.168.0.254 is non-local host
    at sun.rmi.registry.RegistryImpl.checkAccess(RegistryImpl.java:228)
    at sun.rmi.registry.RegistryImpl.rebind(RegistryImpl.java:152)
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:386)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)

@activeeon-bot
Copy link
Author

Original comment posted by Clement Mathieu on 15, May 2009 at 11:11 AM


RMI does not support NAT and invalid proactive.hostname usage -> closing as invalid

proactive.hostname can be used to set the name of the local runtime when proactive.net.(interface|netmask|nolocal|noprivate) do not work. Usually, it is used to set a FQDN as hostname that can be resolved from the outside of the LAN.

Since your machine and your router are two distinct hosts, it is obvious that it cannot work.

@activeeon-bot
Copy link
Author

Original comment posted by Florin Bratu on 15, May 2009 at 11:36 AM


RMI does not support NAT
Is this an official position? I advise you to RTFM:
http://java.sun.com/j2se/1.4.2/docs/guide/rmi/javarmiproperties.html
in particular about java.rmi.server.hostname

invalid proactive.hostname usage
Invalid proactive.hostname usage comes from invalid documentation. The manual says:
http://proactive.inria.fr/release-doc/pa/multiple_html/Configuration.html
about proactive.hostname:
"proactive.hostname when this property is set, the host name on which the jvm is started is given by the value of the property. This property is particularly usefull to deal with machines with two network interfaces "
"If proactive.hostname is set, then the value returned by InetAddress.getByName(proactive.hostname) is elected. If no IP address is found, then the runtime exits with an error message. "
I don't see any mention of "local runtime" in the documentation.

Usually, it is used to set a FQDN as hostname that can be resolved from the outside of the LAN.
This comes in direct contradiction with the comment which is to be found in PAProperties over the definition of proactive.hostname:
/ * * ProActive Runtime Hostname (or IP Address)
* * This option can be used to set manually the Runtime IP Address. Can be
* useful when the Java networking stack return a bad IP address (example: multihomed machines).
* **/

@activeeon-bot
Copy link
Author

Original comment posted by Clement Mathieu on 15, May 2009 at 14:22 PM


Is this an official position?

Yes.

Reading is not sufficient, you have to understand the manual. Feel free to propose a solution to bypass NAT with java.rmi.server.hostname. Your contribution is welcome.

The manual says: (link: ...)

Do you understand what multihomed stands form and what is a router ?

"local runtime"

You can set proactive.hostname to "www.google.com" if you want. But do not complain it does not work. The IP address of the router is not local, it will not work.

This comes in direct contradiction

It is not a contradiction, you should read more carefully the documentation. You can use proactive.hostname with an hostname or an IP address. Usually you use it with an FQDN which can be resolved by all the machines involved in the computation (usually a CNAME record). Since proactive.net.* properties are easier to use, it is unusual to set proactive.hostname to an IP address.

I will not respond anymore to this bug report. The value of proactive.hostname must resolve to the local machine.

@activeeon-bot
Copy link
Author

Original comment posted by Florin Bratu on 15, May 2009 at 14:41 PM


RMI does not support NAT
Is this an official position?
Yes.
I want to see Sun's official announcement about this. This is what "official position" means. Until I see it, I will take that everything you put here was your personal opinion - and in a very insulting tone also!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant