10 Replies Latest reply on Oct 10, 2008 8:04 AM by Brendan Doherty

    jgroups Draw demo fails

    john godfrey Newbie

      We are trying to get jgroups working using version 2.6.3 on windows XP, our deployment works on unix. To eradicate our code we simply execute the demo class Draw twice and the second fails with the stack lisetd below.
      The firewall is disabled. Are we missing some thing obvious ?

      org.jgroups.ChannelException: failed to start protocol stack
      at org.jgroups.JChannel.startStack(JChannel.java:1545)
      at org.jgroups.JChannel.connect(JChannel.java:364)
      at org.jgroups.demos.Draw.go(Draw.java:174)
      at org.jgroups.demos.Draw.main(Draw.java:144)
      Caused by: java.lang.Exception: problem creating sockets (bind_addr=LDN-BUSDEV-32/192.168.13.98, mcast_addr=null)
      at org.jgroups.protocols.UDP.start(UDP.java:373)
      at org.jgroups.stack.Configurator.startProtocolStack(Configurator.java:124)
      at org.jgroups.stack.ProtocolStack.startStack(ProtocolStack.java:392)
      at org.jgroups.JChannel.startStack(JChannel.java:1542)
      ... 3 more
      Caused by: java.net.BindException: Address already in use: Cannot bind
      at java.net.PlainDatagramSocketImpl.bind0(Native Method)
      at java.net.PlainDatagramSocketImpl.bind(Unknown Source)
      at java.net.DatagramSocket.bind(Unknown Source)
      at java.net.MulticastSocket.(Unknown Source)
      at java.net.MulticastSocket.(Unknown Source)
      at org.jgroups.protocols.UDP.createSockets(UDP.java:480)
      at org.jgroups.protocols.UDP.start(UDP.java:369)

      A further complication is that the jgroups tests McastReceiverTest and McastSenderTest does not work until wireshark is started and traffic monitored. Stopping/starting wireshark toggles the test from working to failing without test sender/receiver restart.

        • 1. Re: jgroups Draw demo fails
          Bela Ban Master

          Post your XML config file. Your mcast_addr is null, that should not be the case

          • 2. Re: jgroups Draw demo fails
            john godfrey Newbie

            We simply executed the demo as instructed in the installation and configuration as follows:

            java -cp jgroups-all-2.6.3.jar;log4j-1.2.12.jar;commons-logging-1.1.jar org.jgroups.demos.Draw

            using jre1.5.0_15 and from a directory that simply had the three jar files on the classpath.

            This fails on both of my xp machines and a 2000 machine.

            • 3. Re: jgroups Draw demo fails
              Bela Ban Master

              Works for me. Is binding to 192.168.13.98 an issue ? You could use -Djgroups.bind_addr=1.2.3.4 to pick a different NIC to bind to. You might also want to use -Djgroups.udp.mcast_addr=x.x.x.x, see http://wiki.jboss.org/wiki/SystemProps for all supported system props.
              In the worst case, debug this, set a breakpoint in UDP.createSockets() and see what values you have

              • 4. Re: jgroups Draw demo fails
                john godfrey Newbie

                I was hoping to save going into all the details but we have previously done everything that you suggest. With a breakpoint set in createSockets of org.jgroups.protocols the exception is thrown in the constructor of MulticastSocket which is marked as label 3e' in the src. The mcast_addr object is shown as null in the exceptiopn output as it is not created until after the point of exception.

                We can provide remote access using isllight using standard browsers if desired.

                • 5. Re: jgroups Draw demo fails
                  Bela Ban Master

                  Just before creating the MulticastSocket, check whether that port is already taken:
                  netstat -na|grep 45588 (or whatever the value of mcast_port is).
                  Other MulticastSockets being open on 45588 is not an issue, but a datagram socket might be.
                  Also try -Djava.net.preferIPv4Stack=true

                  • 6. Re: jgroups Draw demo fails
                    john godfrey Newbie

                    I did as you suggested and when I looked at the netstat output there is an entry as follows:

                    UDP 0.0.0.0:45591

                    with of course 45591 being the port that a MulticastSocket is to be created on.

                    • 7. Re: jgroups Draw demo fails
                      Bela Ban Master

                      Then change the multicast port to a different value and see what happens. Use the system props define earlier. Note that all instances need to use the same mcast_port

                      • 8. Re: jgroups Draw demo fails
                        john godfrey Newbie

                        We need to have two processes running on the same PC communicating through multicast as the Draw demo can do. We have only one NIC so the bind_address must be the ip address. Given that the command

                        java -cp jgroups-all-2.6.3.jar;log4j-1.2.12.jar;commons-logging-1.1.jar org.jgroups.demos.Draw -bind_addr 192.168.13.98

                        is used and this fails for the second Draw. netstat shows an entry with the default port 1077 existing as UDP 192.168.13.98:1077.

                        The Draw demo does not appear to accept changing the multicast address or port from the command line.

                        Note that the Draw DEMO works on our network when run on different PCs with the default bind address.

                        • 9. Re: jgroups Draw demo fails
                          Bela Ban Master

                          Works for me without any problems. Make sure you do NOT define a port for UDP, e.g. bind_port in the XML file or an equivalent system property

                          • 10. Re: jgroups Draw demo fails
                            Brendan Doherty Newbie

                            Hi, was this issue ever resolved? I to seem to be having very similar problems on Windows XP and 2000.


                            GetNetworkInterfaces


                            C:\jgroups\JGROUP~1.BIN>java -Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=170.198.227.92 -Djgroups.udp.mcast_addr=239.10.10.10 -Djgroups.udp.mcast_port=7654
                            -cp ./;jgroups-all.jar;commons-logging.jar;log4j.properties org.jgroups.util.GetNetworkInterfaces
                            lo:
                            MS TCP Loopback interface
                            /127.0.0.1 (127.0.0.1)
                            ---------------------
                            eth0:
                            Broadcom NetXtreme Gigabit Ethernet Driver
                            /170.198.227.92 (bd01.cstplc.lan)
                            ---------------------





                            Multicast Discover Test


                            org.jgroups.tests.McastDiscovery

                            ========================================================
                            Responses received ordered by interface:

                            170.198.227.92: [/127.0.0.1:3896, /170.198.227.92:3897]
                            127.0.0.1: [/127.0.0.1:3896, /170.198.227.92:3897]

                            -- Valid interfaces are [/170.198.227.92, /127.0.0.1]


                            Use of any of the above interfaces in "UDP(bind_addr=)" will guarantee that the members will find each other
                            ========================================================


                            First Instance of the Draw Application


                            C:\jgroups\JGROUP~1.BIN>java -Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=170.198.227.92 -Djgroups.udp.mcast_addr=239.10.10.10 -Djgroups.udp.mcast_port=7
                            654 -cp ./;jgroups-all.jar;commons-logging.jar;log4j.properties org.jgroups.demos.Draw
                            10-Oct-2008 12:32:42 org.jgroups.JChannel init
                            INFO: JGroups version: 2.6.4.GA

                            -------------------------------------------------------
                            GMS: address is 170.198.227.92:4805
                            -------------------------------------------------------
                            ** View=[170.198.227.92:4805|0] [170.198.227.92:4805]


                            A nestat -an returns the following info

                            TCP 170.198.227.92:4806 0.0.0.0:0 LISTENING
                            UDP 0.0.0.0:7654 *:*

                            Restarting this first instance, the port showing in the Draw app window is always one less than the port showing in the netstat output.


                            Second Instance of the Draw Application


                            C:\jgroups\JGroups-2.6.4.GA.bin>java -Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=170.198.227.92 -Djgroups.udp.mcast_addr=239.10.10.10 -Djgroups.udp.mcas
                            t_port=7654 -cp ./;jgroups-all.jar;commons-logging.jar;log4j.jar org.jgroups.demos.Draw
                            log4j:ERROR Could not find value for key log4j.appender.AtsEventLogFile
                            log4j:ERROR Could not instantiate appender named "AtsEventLogFile".
                            INFO - [main] JGroups version: 2.6.4.GA
                            DEBUG - [main] mapping is:
                            1: class org.jgroups.stack.IpAddress
                            2: class org.jgroups.protocols.CAUSAL$CausalHeader
                            3: class org.jgroups.protocols.FD$FdHeader
                            6: class org.jgroups.protocols.FD_SOCK$FdHeader
                            7: class org.jgroups.protocols.FragHeader
                            13: class org.jgroups.protocols.PingHeader
                            14: class org.jgroups.protocols.TcpHeader
                            19: class org.jgroups.protocols.TunnelHeader
                            20: class org.jgroups.protocols.UdpHeader
                            21: class org.jgroups.protocols.UNICAST$UnicastHeader
                            22: class org.jgroups.protocols.VERIFY_SUSPECT$VerifyHeader
                            24: class org.jgroups.protocols.pbcast.GMS$GmsHeader
                            25: class org.jgroups.protocols.pbcast.NakAckHeader
                            27: class org.jgroups.protocols.pbcast.STABLE$StableHeader
                            28: class org.jgroups.protocols.pbcast.STATE_TRANSFER$StateHeader
                            29: class org.jgroups.protocols.SMACK$SmackHeader
                            30: class org.jgroups.Message
                            31: class org.jgroups.View
                            32: class org.jgroups.ViewId
                            34: interface org.jgroups.Address
                            35: class org.jgroups.blocks.RequestCorrelator$Header
                            36: class org.jgroups.protocols.PingRsp
                            38: class java.util.Vector
                            39: class org.jgroups.protocols.pbcast.JoinRsp
                            40: class org.jgroups.util.Digest
                            41: class java.util.Hashtable
                            53: class org.jgroups.protocols.COMPRESS$CompressHeader
                            54: class org.jgroups.protocols.FC$FcHeader
                            56: class org.jgroups.protocols.TpHeader
                            57: class org.jgroups.protocols.ENCRYPT$EncryptHeader
                            58: class org.jgroups.protocols.SEQUENCER$SequencerHeader
                            59: class org.jgroups.protocols.FD_SIMPLE$FdHeader
                            60: class org.jgroups.protocols.VIEW_SYNC$ViewSyncHeader
                            61: class org.jgroups.protocols.FD_ALL$Header
                            62: class org.jgroups.protocols.SFC$Header
                            63: class org.jgroups.mux.MuxHeader
                            64: class org.jgroups.protocols.pbcast.FLUSH$FlushHeader
                            65: class org.jgroups.protocols.pbcast.STREAMING_STATE_TRANSFER$StateHeader
                            66: class org.jgroups.blocks.PullPushAdapter$PullHeader
                            67: class org.jgroups.protocols.AuthHeader

                            DEBUG - [main] changed role to org.jgroups.protocols.pbcast.ClientGmsImpl
                            DEBUG - [main] frag_size=60000, overhead=200, new frag_size=59800
                            DEBUG - [main] received CONFIG event: {bind_addr=/170.198.227.92}
                            DEBUG - [main] received CONFIG event: {bind_addr=/170.198.227.92}
                            TRACE - [main] stable task started
                            DEBUG - [main] creating sockets and starting threads
                            DEBUG - [main] sockets will use interface 170.198.227.92
                            org.jgroups.ChannelException: failed to start protocol stack
                            at org.jgroups.JChannel.startStack(JChannel.java:1545)
                            at org.jgroups.JChannel.connect(JChannel.java:364)
                            at org.jgroups.demos.Draw.go(Draw.java:174)
                            at org.jgroups.demos.Draw.main(Draw.java:144)
                            Caused by: java.lang.Exception: problem creating sockets (bind_addr=/170.198.227.92, mcast_addr=null)
                            at org.jgroups.protocols.UDP.start(UDP.java:373)
                            at org.jgroups.stack.Configurator.startProtocolStack(Configurator.java:124)
                            at org.jgroups.stack.ProtocolStack.startStack(ProtocolStack.java:392)
                            at org.jgroups.JChannel.startStack(JChannel.java:1542)
                            ... 3 more
                            Caused by: java.net.BindException: Address already in use: Cannot bind
                            at java.net.PlainDatagramSocketImpl.bind0(Native Method)
                            at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82)
                            at java.net.DatagramSocket.bind(DatagramSocket.java:368)
                            at java.net.MulticastSocket.(MulticastSocket.java:147)
                            at java.net.MulticastSocket.(MulticastSocket.java:112)
                            at org.jgroups.protocols.UDP.createSockets(UDP.java:480)
                            at org.jgroups.protocols.UDP.start(UDP.java:369)
                            ... 6 more

                            Using wireshark I can see the UDP traffic coming from 170.198.227.92 to 239.10.10.10 with a src/dst port of 7654

                            Multicast Send/Recieve test works fine


                            C:\jgroups\JGROUP~1.BIN>java -Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=170.198.227.92 -Djgroups.udp.mcast_addr=239.10.10.10 -Djgroups.udp.mcast_port=7
                            654 -cp ./;jgroups-all.jar;commons-logging.jar;log4j.properties org.jgroups.tests.McastSenderTest
                            Socket=0.0.0.0/0.0.0.0:4874, ttl=32, bind interface=/0.0.0.0
                            > me again
                            > << Received response from 170.198.227.92:5555: Hello from Bela


                            C:\jgroups\JGroups-2.6.4.GA.bin>java -Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=170.198.227.92 -Djgroups.udp.mcast_addr=239.10.10.10 -cp jgroups-all.ja
                            r;commons-logging.jar;log4j.properties org.jgroups.tests.McastReceiverTest
                            Socket=0.0.0.0/0.0.0.0:5555, bind interface=/0.0.0.0
                            me again [sender=170.198.227.92:4874]


                            Can anyone point me in the right direction to resolve this issue.

                            Many Thanks
                            Brendan