Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-3535

Yarn service subclasses don't check for service state before executing their state change operations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.23.0, 2.0.0-alpha
    • None
    • mrv2
    • None

    Description

      Although there are checks in the lifecycle state change methods (start, stop, ...), they only get checked in the superclass. The subclasses don't check it; they don't exit the start() method if they are already started, and they don't bail out early on a stop if they are already stopped -even when the superclass returns without doing anything.

      This means that calling Service.start() twice may leak resources, Service.start() twice try to shut down twice, etc. And that's on the same thread...

      My preferred action here would be for the ave the operations return true if a state change took place, the implementation would be synchronised and return the correct value

      The subclasses look for this and only execute their state changes took place

      e.g

      boolean start() {
       if (!super.start()) return false;
       //do my own startup
       return true;
      }
      

      The Service.stop() operation is trickier as the subclasses tend to call the superclass last for a better unwinding. I think it may be safer to work the other way around, but code reviews would be need to ensure that this doesn't break assumptions in the subclass about termination order. It may be possible to do more complex designs, but it is hard to chain this down a hierarchy of classes.

      Attachments

        Activity

          People

            Unassigned Unassigned
            stevel@apache.org Steve Loughran
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: