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

Roman Shaposhnik commented on ZOOKEEPER-1089:
---------------------------------------------

After additional investigation it turns out that '-q' is a Ubuntu specific 
patch on top of netcat-openbsd: 
http://archive.ubuntu.com/ubuntu/pool/main/n/netcat-openbsd/netcat-openbsd_1.89-3ubuntu2.diff.gz

It seems to be dealing with the situation where the channel is half-closed (by 
the client) and the server still performs
a write (q corresponds to a qflag):

{noformat}
    else if (pfd[1].revents & POLLHUP) {
    shutdown_wr:
        /* if the user asked to exit on EOF, do it */
        if (qflag == 0) { 
                 shutdown(nfd, SHUT_WR);
                 close(wfd);
                 exit(0);
        }       
        /* if user asked to die after a while, arrange for it */
        if (qflag > 0) {
                 signal(SIGALRM, quit);
                 alarm(qflag);
        }       
        pfd[1].fd = -1;
        pfd[1].events = 0;
    }       
{noformat}

That matches line #235 in 
http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java?view=markup

If my analysis is correct, then the only way to really fix this problem is to 
provide a Java wrapper inside of ZK itself. To the best of my knowledge bash 
and awk are not capable of dealing with half closed TCP sockets. 
                
> zkServer.sh status does not work due to invalid option of nc
> ------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1089
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1089
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: scripts
>    Affects Versions: 3.3.4, 3.4.0
>            Reporter: Bill Au
>            Assignee: Roman Shaposhnik
>
> The nc command used by zkServer.sh does not have the "-q" option on some 
> linux versions ( I have checked RedHat/Fedora and FreeBSD).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to