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

Incorrect synchronization in RMContextImpl#setHAServiceState/getHAServiceState

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8.0, 3.0.0-alpha2
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: