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

CloserThread's attempt to interrupt TimeScheduler on closure could be end up being ignored

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.4.1 SP3, 2.5
    • 2.2.7 SP1, 2.2.8, 2.2.9, 2.2.9.1, 2.2.9.2, 2.2.9 SP3 (2.2.9.3), 2.2.9 SP4, 2.3, 2.3 SP1, 2.4, 2.4.1, 2.4.1 SP1, 2.4.1 SP2
    • None
    • Medium

      A race condition in JGroups could cause a channel that should be closed (for example, after being shunned)
      to never be closed.

      In order to stop TimeScheduler thread, CloserThread set's TimeScheduler's thread status
      as interrupted. If the interruption occurs while TimeScheduler is waiting, then no problems.

      But, in TimeScheduler._run(), actual running of a task via task.run(); happens outside
      synchronized(queue) block which means that CloserThread could set the TimeSchedule thread's
      status as interrupted while the task is running, for example, sending an FD are-you-alive message.

      If down the protocol that's carrying out the task, all down threads are set to false, and TimeScheduler
      thread is interrupted while the task is running, the interruption could be caught while sending a message to network:

      TP (UDP and TCP/TCP_NIO's parent):

      TP.down(Event evt)
      ....

      try {
      if(use_outgoing_packet_handler)
      outgoing_queue.put(msg);
      else
      send(msg, dest, multicast);
      }
      catch(QueueClosedException closed_ex) {
      }
      catch(InterruptedException interruptedEx) {
      }
      catch(Throwable e) {
      if(log.isErrorEnabled()) log.error("failed sending message", e);
      }

      Catching InterruptedException and doing nothing will clear the Thread's interrupted status. If
      the interruption from CloserThread is caught here, TimeScheduler thread will never finished,
      leaving the channel blocked and never rejoining the cluster and unable to merge back.

            rhn-engineering-bban Bela Ban
            rh-ee-galder Galder ZamarreƱo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: