Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2257

UDP#PacketReceiver stuck in busy loop when socket throws closed exception but socket is not closed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Major
    • 4.0.12
    • 3.6.12
    • None
    • Hide

      Never seen it before and have no idea what triggered it or how to reproduce.

      Show
      Never seen it before and have no idea what triggered it or how to reproduce.

    Description

      I have a had a report of a scenario where it looks like the UDP#PacketReceiver is stuck spinning in a busy loop. The following is a snippet of the log file from the system in question.

      2018-03-16 14:05:43,273 SEVERE [] (214,unicast receiver,shared=udp) JGRP000190: failed receiving packet
      java.net.SocketException: socket closed
                    at java.net.TwoStacksPlainDatagramSocketImpl.peekData(Native Method)
                    at java.net.DatagramSocket.receive(DatagramSocket.java:743)
                    at org.jgroups.protocols.UDP$PacketReceiver.run(UDP.java:694)
                    at java.lang.Thread.run(Thread.java:748)
       
      2018-03-16 14:05:43,273 SEVERE [] (214,unicast receiver,shared=udp) JGRP000190: failed receiving packet
      java.net.SocketException: socket closed
                    at java.net.TwoStacksPlainDatagramSocketImpl.peekData(Native Method)
                    at java.net.DatagramSocket.receive(DatagramSocket.java:743)
                    at org.jgroups.protocols.UDP$PacketReceiver.run(UDP.java:694)
                    at java.lang.Thread.run(Thread.java:748)
       
      2018-03-16 14:05:43,273 SEVERE [] (214,unicast receiver,shared=udp) JGRP000190: failed receiving packet
      java.net.SocketException: socket closed
                    at java.net.TwoStacksPlainDatagramSocketImpl.peekData(Native Method)
                    at java.net.DatagramSocket.receive(DatagramSocket.java:743)
                    at org.jgroups.protocols.UDP$PacketReceiver.run(UDP.java:694)
                    at java.lang.Thread.run(Thread.java:748)
       

      Looking at the code it looks like the call to receive a packet

      receiver_socket.receive(packet);
      

      results in an exception being thrown because the socket is closed but then when the exception is caught

      if(receiver_socket.isClosed()) {
      

      method is queried which says the socket has not been closed and the loop then continues for ever.

      I guess this is related to JGRP-1669. To quote

      I hope there is no condition which causes the socket receive() to spit out endless exceptions while not being closed...

      Attachments

        Activity

          People

            rhn-engineering-bban Bela Ban
            pillingworth Paul Illingworth (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: