hadoop-yarn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Varun Saxena (JIRA)" <j...@apache.org>
Subject [jira] [Created] (YARN-5921) Incorrect synchronization in RMContextImpl#setHAServiceState/getHAServiceState
Date Mon, 21 Nov 2016 21:49:58 GMT
Varun Saxena created YARN-5921:
----------------------------------

             Summary: Incorrect synchronization in RMContextImpl#setHAServiceState/getHAServiceState
                 Key: YARN-5921
                 URL: https://issues.apache.org/jira/browse/YARN-5921
             Project: Hadoop YARN
          Issue Type: Bug
            Reporter: Varun Saxena
            Assignee: Varun Saxena


Code in RMContextImpl is as under:

{code:title=RMContextImpl.java|borderStyle=solid}
  void setHAServiceState(HAServiceState haServiceState) {
    synchronized (haServiceState) {
      this.haServiceState = haServiceState;
    }
  }

  public HAServiceState getHAServiceState() {
    synchronized (haServiceState) {
      return haServiceState;
    }
  }
{code}

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. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-dev-help@hadoop.apache.org


Mime
View raw message