Tsz-wo Sze created RATIS-2336:
---------------------------------

             Summary: PeerProxyMap.getProxy() could return null
                 Key: RATIS-2336
                 URL: https://issues.apache.org/jira/browse/RATIS-2336
             Project: Ratis
          Issue Type: Bug
          Components: util
            Reporter: Tsz-wo Sze
            Assignee: Tsz-wo Sze


{code}
//PeerProxyMap.java
    PROXY getProxy() throws IOException {
      if (proxy == null) {
        synchronized (this) {
          if (proxy == null) {
            final LifeCycle.State current = lifeCycle.getCurrentState();
            if (current.isClosingOrClosed()) {
              throw new AlreadyClosedException(name + " is already " + current);
            }
            lifeCycle.startAndTransition(
                () -> proxy = createProxyImpl(peer), IOException.class);
          }
        }
      }
      return proxy;
    }
{code}
It the code above, the proxy is returned outside synchronized (this).  Then, it 
is possible that  proxy is set to null before returning.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to