openlvc / portico

Portico is an open source, cross-platform, fully supported HLA RTI implementation. Designed with modularity and flexibility in mind, Portico is a production-grade RTI for the Simulation and Training Community, so come say hi!
http://www.porticoproject.org
151 stars 81 forks source link

portico.jgroups.udp.bindAddress parsing error for the RID file #169

Open hodiapa opened 8 years ago

hodiapa commented 8 years ago

If one sets the interface for the bindAddress there is a parsing error eg: "portico.jgroups.udp.bindAddress = match-interface:ethwe.*"

Here is the exception:

caused by: java.lang.Exception: Conversion of bind_addr in UDP with original property value match-interface:ethwe.* failed
    at org.jgroups.conf.PropertyHelper.getConvertedValue(PropertyHelper.java:85)
    at org.jgroups.stack.Configurator.resolveAndAssignField(Configurator.java:1144)
    ... 22 more
Caused by: java.net.UnknownHostException: match-interface:ethwe.*
    at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:922)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1316)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1269)
    at java.net.InetAddress.getAllByName(InetAddress.java:1185)
    at java.net.InetAddress.getAllByName(InetAddress.java:1119)
    at java.net.InetAddress.getByName(InetAddress.java:1069)
    at org.jgroups.conf.PropertyConverters$Default.convert(PropertyConverters.java:257)
    at org.jgroups.conf.PropertyHelper.getConvertedValue(PropertyHelper.java:82)
    ... 23 more

same thing with regards to "match-address:192.168." filter

I am using portico-2.0.2

timpokorny commented 8 years ago

G'day @hodiapa - I shall take a look. We just pass this value straight through to JGroups for processing. Have you got an example of a string you were trying to match to?

hodiapa commented 8 years ago

Yes. as stated in the description two examples for the commands to include in the RID file: "portico.jgroups.udp.bindAddress = match-interface:ethwe.*"

and

"portico.jgroups.udp.bindAddress = match-address:192.168."

timpokorny commented 8 years ago

I am seeing a bunch of frustrating stuff with the JGroups interface matching at the moment. When I specify LOOPBACK, I only get it if a SITE_LOCAL attribute it not available. If I have wifi on or network plugged in, it just falls back to that, despite my assertions otherwise.

I am going to have to rewrite the bit that does the NIC choosing and just push an explicit value into JGroups rather than relying on its matching.

hodiapa commented 8 years ago

Thanks for looking into the issue

bergtwvd commented 8 years ago

I am running in the same issue. I have a docker container with two network interfaces and I need to force Portico to only use one of them. I do: portico.jgroups.udp.bindAddress = match-address:172.18.238.*

but only get the error below.

Any work-around or update for this issue?

xclient_1         | ERROR [main] portico.lrc.jgroups: ERROR Failed to connect to channel [TheWorld]: Property assignment of bind_addr in UDP with original property value match-address:172.18.238.* and converted to null could not be assigned
xclient_1         | java.lang.Exception: Property assignment of bind_addr in UDP with original property value match-address:172.18.238.* and converted to null could not be assigned
xclient_1         |     at org.jgroups.stack.Configurator.resolveAndAssignField(Configurator.java:1150)
xclient_1         |     at org.jgroups.stack.Configurator.createLayer(Configurator.java:443)
xclient_1         |     at org.jgroups.stack.Configurator.createProtocols(Configurator.java:397)
xclient_1         |     at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:88)
xclient_1         |     at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:55)
xclient_1         |     at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:465)
xclient_1         |     at org.jgroups.JChannel.init(JChannel.java:794)
xclient_1         |     at org.jgroups.JChannel.<init>(JChannel.java:167)
xclient_1         |     at org.jgroups.JChannel.<init>(JChannel.java:147)
xclient_1         |     at org.portico.bindings.jgroups.channel.Channel.constructChannel(Channel.java:151)
xclient_1         |     at org.portico.bindings.jgroups.channel.Channel.connect(Channel.java:124)
xclient_1         |     at org.portico.bindings.jgroups.Federation.connect(Federation.java:122)
xclient_1         |     at org.portico.bindings.jgroups.JGroupsConnection.findFederation(JGroupsConnection.java:205)
xclient_1         |     at org.portico.bindings.jgroups.JGroupsConnection.createFederation(JGroupsConnection.java:217)
xclient_1         |     at org.portico.lrc.services.federation.handlers.outgoing.CreateFederationHandler.process(CreateFederationHandler.java:89)
xclient_1         |     at org.portico.utils.messaging.MessageSink.process(MessageSink.java:187)
xclient_1         |     at org.portico.impl.hla1516e.Impl1516eHelper.processMessage(Impl1516eHelper.java:130)
xclient_1         |     at org.portico.impl.hla1516e.Rti1516eAmbassador.processMessage(Rti1516eAmbassador.java:5559)
xclient_1         |     at org.portico.impl.hla1516e.Rti1516eAmbassador.createFederationExecution(Rti1516eAmbassador.java:315)
xclient_1         |     at viewer.Federate.connectAndJoin(Federate.java:79)
xclient_1         |     at viewer.Main.main(Main.java:60)
x
<cut>
timpokorny commented 8 years ago

This error is happening somewhere inside the JGroups NIC resolution code. I'll look at updating the version of the library to see if that resolves the issue, but if it doesn't we'll have to write our own resolution code (hopefully pretty straightforward if required).

In the mean time, could you flick me the ifconfig output for the box?

Cheers, Tim

On 19 Jun 2016, at 10:44 AM, bergtwvd notifications@github.com<mailto:notifications@github.com> wrote:

I am running in the same issue. I have a docker container with two network interfaces and I need to force Portico to only use one of them. I do: portico.jgroups.udp.bindAddress = match-address:172.18.238.*

but only get the error below.

Any work-around or update for this issue?

xclient_1 | ERROR [main] portico.lrc.jgroups: ERROR Failed to connect to channel [TheWorld]: Property assignment of bind_addr in UDP with original property value match-address:172.18.238.* and converted to null could not be assigned xclient_1 | java.lang.Exception: Property assignment of bind_addr in UDP with original property value match-address:172.18.238.* and converted to null could not be assigned xclient_1 | at org.jgroups.stack.Configurator.resolveAndAssignField(Configurator.java:1150) xclient_1 | at org.jgroups.stack.Configurator.createLayer(Configurator.java:443) xclient_1 | at org.jgroups.stack.Configurator.createProtocols(Configurator.java:397) xclient_1 | at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:88) xclient_1 | at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:55) xclient_1 | at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:465) xclient_1 | at org.jgroups.JChannel.init(JChannel.java:794) xclient_1 | at org.jgroups.JChannel.(JChannel.java:167) xclient_1 | at org.jgroups.JChannel.(JChannel.java:147) xclient_1 | at org.portico.bindings.jgroups.channel.Channel.constructChannel(Channel.java:151) xclient_1 | at org.portico.bindings.jgroups.channel.Channel.connect(Channel.java:124) xclient_1 | at org.portico.bindings.jgroups.Federation.connect(Federation.java:122) xclient_1 | at org.portico.bindings.jgroups.JGroupsConnection.findFederation(JGroupsConnection.java:205) xclient_1 | at org.portico.bindings.jgroups.JGroupsConnection.createFederation(JGroupsConnection.java:217) xclient_1 | at org.portico.lrc.services.federation.handlers.outgoing.CreateFederationHandler.process(CreateFederationHandler.java:89) xclient_1 | at org.portico.utils.messaging.MessageSink.process(MessageSink.java:187) xclient_1 | at org.portico.impl.hla1516e.Impl1516eHelper.processMessage(Impl1516eHelper.java:130) xclient_1 | at org.portico.impl.hla1516e.Rti1516eAmbassador.processMessage(Rti1516eAmbassador.java:5559) xclient_1 | at org.portico.impl.hla1516e.Rti1516eAmbassador.createFederationExecution(Rti1516eAmbassador.java:315) xclient_1 | at viewer.Federate.connectAndJoin(Federate.java:79) xclient_1 | at viewer.Main.main(Main.java:60) x

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/openlvc/portico/issues/169#issuecomment-226972943, or mute the threadhttps://github.com/notifications/unsubscribe/AA3rUbQoxplfcPtFTCNVgjm38A7H9TTlks5qNJDagaJpZM4HacG5. This message and any attachments are confidential and commercial-in-confidence, and are intended solely for the use of the individual or entity to whom the message is addressed. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error and that any use, dissemination, forwarding, printing or copying of this message and any file attachments is strictly prohibited. Any views or opinions presented are solely those of the author and do not necessarily represent those of Calytrix Technologies. If you have received this message in error, please immediately notify us by reply message to the sender.
bergtwvd commented 8 years ago

Below the information:

I want to test up a "training" network for the sims and an X11 network for the X-apps.

Dockerfile fragement:

 xclient:
  links:
  - xserver
  image: test/xclient
  environment:
  - DISPLAY=xserver:0
  - FEDERATIONNAME=${COMPOSE_PROJECT_NAME}
  - MINSLEEP=15
#  - PORTICO_JGROUPS_UDP_BINDADDRESS=match-address:172.18.238.*
#  - PORTICO_LOGLEVEL=DEBUG
  - PORTICO_UNIQUEFEDERATENAMES=false
  networks:
  - training
  - x11

 xserver:
  image: test/xserver
  ports:
  - "5900:5900"
  - "9001:9001"
  networks:
  - x11

networks:
 training:
  driver: bridge
  driver_opts:
   com.docker.network.enable_ipv6: "false"
  ipam:
   driver: default
   config:
   - subnet: 172.18.238.0/24
     gateway: 172.18.238.1
 x11:
eth0      Link encap:Ethernet  HWaddr 02:42:AC:12:EE:06
          inet addr:172.18.238.6  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::42:acff:fe12:ee06%32512/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:577 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3313201 (3.1 MiB)  TX bytes:756 (756.0 B)

eth1      Link encap:Ethernet  HWaddr 02:42:AC:11:00:03
          inet addr:172.17.0.3  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:acff:fe11:3%32512/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:264 errors:0 dropped:0 overruns:0 frame:0
          TX packets:225 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:36952 (36.0 KiB)  TX bytes:93889 (91.6 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%32512/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:315 (315.0 B)  TX bytes:315 (315.0 B)
hodiapa commented 8 years ago

I think the way I tackled this issue is directly reading the IP address and assigning it to the "portico.jgroups.udp.bindAddress" within the docker container.

So create a start.sh script which reads the IP address of whichever network interface you are interested in:either eth1 or eth0. Copy this IP address and echo it to the rti.rid file

 IP_address_desired_interface= get the IP address from the desired interface.
echo "portico.jgroups.udp.bindAddress  = IP_address_desired_interface" >> rti.rid
bergtwvd commented 8 years ago

Any more detail on this?

I set the portico.jgroups.udp.bindAddress in the RID file, by passing in the value as an environment variable and running a script that changes the RID file.

From: hodiapa [mailto:notifications@github.com] Sent: maandag 20 juni 2016 23:21 To: openlvc/portico Cc: Berg, T.W. (Tom) van den; Comment Subject: Re: [openlvc/portico] portico.jgroups.udp.bindAddress parsing error for the RID file (#169)

I think the way I tackled this issue is directly reading the IP address and assigning it to the "portico.jgroups.udp.bindAddress" within the docker container

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/openlvc/portico/issues/169#issuecomment-227273318, or mute the threadhttps://github.com/notifications/unsubscribe/AKKCS18tFlyiAnnoWlY_S9r2ygpxgff0ks5qNwROgaJpZM4HacG5. This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

hodiapa commented 8 years ago

I think the way I tackled this issue is directly reading the IP address and assigning it to the "portico.jgroups.udp.bindAddress" within the docker container.

So create a start.sh script which reads the IP address of whichever network interface you are interested in:either eth1 or eth0. Copy this IP address and echo it to the rti.rid file

 IP_address_desired_interface= get the IP address from the desired interface.
echo "portico.jgroups.udp.bindAddress  = IP_address_desired_interface" >> rti.rid

Hope this helps