[ 
https://issues.apache.org/jira/browse/RATIS-2336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz-wo Sze resolved RATIS-2336.
-------------------------------
    Fix Version/s: 3.3.0
       Resolution: Fixed

The pull request is now merged.

> 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
>            Priority: Major
>             Fix For: 3.3.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> {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