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

UDP should not stop message receiver thread after SocketException is caught

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 3.4
    • 2.6.13
    • None

      One of our customers is getting the following error sporadically:

      java.net.SocketException: socket closed
              at java.net.PlainDatagramSocketImpl.receive0(Native Method)
              at java.net.PlainDatagramSocketImpl.receive(Unknown Source)
              at java.net.DatagramSocket.receive(Unknown Source)
              at org.jgroups.protocols.UDP.run(UDP.java:262)
              at java.lang.Thread.run(Unknown Source)
      

      (note that I modified UPD class to log the full stack trace because this stack trace was not logged by original version of UDP)

      I'm sure that socket was not closed by any Java code, the sender thread keeps running and sending messages via the same socket (if mcast_socket.close() had been called, the mcast_socket.send() would have thrown "socket closed" exception too but it did not).

      The main problem that this error stops the receiver thread so node stops receiving UDP messages from other nodes in the cluster.

      We cannot reproduce the error in our environment but I found cases of similar problem on the Internet:

      Given all that I think that UDP receiver thread should check mcast_socket.isClosed() before exiting. If socket is still open the thread should continue running (it may be safer to close the old socket and create a new one though)

              rhn-engineering-bban Bela Ban
              korostov Aleksandr Korostov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: