Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-5921

Incorrect synchronization in RMContextImpl#setHAServiceState/getHAServiceState

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8.0, 3.0.0-alpha2
    • None
    • None

    Description

      Code in RMContextImpl is as under:

      RMContextImpl.java
        void setHAServiceState(HAServiceState haServiceState) {
          synchronized (haServiceState) {
            this.haServiceState = haServiceState;
          }
        }
      
        public HAServiceState getHAServiceState() {
          synchronized (haServiceState) {
            return haServiceState;
          }
        }
      

      As can be seen above, in setHAServiceState, we are synchronizing on the passed haServiceState instead of haServiceState in RMContextImpl which will not lead to desired effect. This does not seem to be intentional.

      We can use a RW lock or synchronize on some object here.

      Attachments

        1. YARN-5921.02.patch
          2 kB
          Varun Saxena
        2. YARN-5921.01.patch
          2 kB
          Varun Saxena

        Activity

          People

            varun_saxena Varun Saxena
            varun_saxena Varun Saxena
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: