[ 
https://issues.apache.org/jira/browse/HADOOP-14519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16047047#comment-16047047
 ] 

Chen Liang edited comment on HADOOP-14519 at 6/12/17 9:10 PM:
--------------------------------------------------------------

Thanks [~jzhuge] for the catch! The patch LGTM. One minor thing though, I think 
the patch slightly changed the syntax of this function. (Please correct me if 
I'm wrong though).

Let's denote condition {{calls.isEmpty() && !shouldCloseConnection.get() && 
running.get()}} as condition A. The original logic works that, it only checks A 
before calling wait, meaning when it gets notified, it returns from wait and 
just proceed, potentially possible that A is still true at this point. While 
the patch changes it that, even when it gets notified, as long as A is true, it 
will keep looping. Could you please verify that this change to the syntax is 
correct? Namely, {{calls.isEmpty() && !shouldCloseConnection.get() && 
running.get()}} is indeed expected to be false always after the object gets 
notified. I'm inclined to believe it is all good based the fact of no test 
failures.



was (Author: vagarychen):
Thanks [~jzhuge] for the catch! The patch LGTM. One minor thing though, I think 
the patch slightly changed the syntax of this function. (Please correct me if 
I'm wrong though).

Let's denote condition {{calls.isEmpty() && !shouldCloseConnection.get() && 
running.get()}} as condition A. The original logic works that, it only checks A 
before calling wait, meaning when it gets notified, it returns from wait and 
just proceed, potentially possible that A is still true at this point. While 
the patch changes it that, even when it gets notified, as long as A is true, it 
will keep looping. Could you please verify that this change to the syntax is 
correct? I'm inclined to believe it is all good based the fact of no test 
failures.


> Client$Connection#waitForWork may suffer spurious wakeup
> --------------------------------------------------------
>
>                 Key: HADOOP-14519
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14519
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: ipc
>    Affects Versions: 2.8.0
>            Reporter: John Zhuge
>            Assignee: John Zhuge
>            Priority: Critical
>         Attachments: HADOOP-14519.001.patch
>
>
> {{Client$Connection#waitForWork}} may suffer spurious wakeup because the 
> {{wait}} is not surrounded by a loop. See 
> [https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#wait()].
> {code:title=Client$Connection#waitForWork}
>       if (calls.isEmpty() && !shouldCloseConnection.get() && running.get())  {
>         long timeout = maxIdleTime-
>               (Time.now()-lastActivity.get());
>         if (timeout>0) {
>           try {
>             wait(timeout);                          <<<<<<==== spurious wakeup
>           } catch (InterruptedException e) {}
>         }
>       }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to