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

Masatake Iwasaki commented on HADOOP-12605:
-------------------------------------------

{code}
      private synchronized void doRunLoop() {
        while (running) {
          SelectionKey key = null;
          try {
            // consume as many connections as currently queued to avoid
            // unbridled acceptance of connections that starves the select
            int size = pendingConnections.size();
            for (int i=size; i>0; i--) {
              Connection conn = pendingConnections.take();
              conn.channel.register(readSelector, SelectionKey.OP_READ, conn);
            }
{code}

The calculation of {{maxAccept = initialClients + readers*readerQ + 1}} assumes 
that 1 connection is taken out from queue at a time but reader take all pending 
connections out from queue in each loop in {{Reader#doRunLoop}}. The number of 
connections accepted until Listner blocks could be greater than the 
{{maxAccept}} if Listner put multiple connections to reader's queue before 
reader process it. ({{maxAccept < server.getNumOpenConnections()}}) 


> Fix intermittent failure of TestIPC.testIpcWithReaderQueuing
> ------------------------------------------------------------
>
>                 Key: HADOOP-12605
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12605
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: test
>            Reporter: Masatake Iwasaki
>            Assignee: Masatake Iwasaki
>            Priority: Minor
>




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

Reply via email to