Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1898

ZooKeeper Java cli shell always returns "0" as exit code

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.4.5
    • 3.5.3, 3.6.0
    • java client
    • None
    • CentOS 6, Claudera Hadoop 5

    • Reviewed

    Description

      zookeeper-cli always return "0" as exit code whether the command has been successful or not.

      Ex:

      Unsuccessful:

      -bash-4.1$ zookeeper-client aa
      Connecting to localhost:2181
      2014-03-20 14:43:01,361 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.5-cdh5.0.0-beta-2--1, built on 02/07/2014 18:28 GMT
      2014-03-20 14:43:01,368 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=ip-172-17-0-105.redlabnet.internal
      2014-03-20 14:43:01,369 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.7.0_51
      2014-03-20 14:43:01,370 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
      2014-03-20 14:43:01,371 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/jre
      2014-03-20 14:43:01,371 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/usr/lib/zookeeper/bin/../build/classes:/usr/lib/zookeeper/bin/../build/lib/*.jar:/usr/lib/zookeeper/bin/../lib/slf4j-log4j12.jar:/usr/lib/zookeeper/bin/../lib/slf4j-log4j12-1.7.5.jar:/usr/lib/zookeeper/bin/../lib/slf4j-api-1.7.5.jar:/usr/lib/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/usr/lib/zookeeper/bin/../lib/log4j-1.2.15.jar:/usr/lib/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/lib/zookeeper/bin/../zookeeper-3.4.5-cdh5.0.0-beta-2.jar:/usr/lib/zookeeper/bin/../src/java/lib/*.jar:/etc/zookeeper/conf::/etc/zookeeper/conf:/usr/lib/zookeeper/zookeeper.jar:/usr/lib/zookeeper/zookeeper-3.4.5-cdh5.0.0-beta-2.jar:/usr/lib/zookeeper/lib/slf4j-log4j12.jar:/usr/lib/zookeeper/lib/slf4j-api-1.7.5.jar:/usr/lib/zookeeper/lib/log4j-1.2.15.jar:/usr/lib/zookeeper/lib/slf4j-log4j12-1.7.5.jar:/usr/lib/zookeeper/lib/jline-0.9.94.jar:/usr/lib/zookeeper/lib/netty-3.2.2.Final.jar
      2014-03-20 14:43:01,372 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
      2014-03-20 14:43:01,373 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
      2014-03-20 14:43:01,374 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
      2014-03-20 14:43:01,375 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
      2014-03-20 14:43:01,375 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
      2014-03-20 14:43:01,376 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-431.3.1.el6.x86_64
      2014-03-20 14:43:01,377 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=hdfs
      2014-03-20 14:43:01,377 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/var/lib/hadoop-hdfs
      2014-03-20 14:43:01,378 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/var/lib/hadoop-hdfs
      2014-03-20 14:43:01,382 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@5220c1b
      ZooKeeper -server host:port cmd args
      	connect host:port
      	get path [watch]
      	ls path [watch]
      	set path data [version]
      	rmr path
      	delquota [-n|-b] path
      	quit 
      	printwatches on|off
      	create [-s] [-e] path data acl
      	stat path [watch]
      	close 
      	ls2 path [watch]
      	history 
      	listquota path
      	setAcl path acl
      	getAcl path
      	sync path
      	redo cmdno
      	addauth scheme auth
      	delete path [version]
      	setquota -n|-b val path
      
      -bash-4.1$ echo $?
      0
      

      Successful:

      -bash-4.1$ zookeeper-client ls /
      Connecting to localhost:2181
      2014-03-20 14:43:53,881 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.5-cdh5.0.0-beta-2--1, built on 02/07/2014 18:28 GMT
      2014-03-20 14:43:53,889 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=ip-172-17-0-105.redlabnet.internal
      2014-03-20 14:43:53,889 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.7.0_51
      2014-03-20 14:43:53,890 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
      2014-03-20 14:43:53,891 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/jre
      2014-03-20 14:43:53,892 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/usr/lib/zookeeper/bin/../build/classes:/usr/lib/zookeeper/bin/../build/lib/*.jar:/usr/lib/zookeeper/bin/../lib/slf4j-log4j12.jar:/usr/lib/zookeeper/bin/../lib/slf4j-log4j12-1.7.5.jar:/usr/lib/zookeeper/bin/../lib/slf4j-api-1.7.5.jar:/usr/lib/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/usr/lib/zookeeper/bin/../lib/log4j-1.2.15.jar:/usr/lib/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/lib/zookeeper/bin/../zookeeper-3.4.5-cdh5.0.0-beta-2.jar:/usr/lib/zookeeper/bin/../src/java/lib/*.jar:/etc/zookeeper/conf::/etc/zookeeper/conf:/usr/lib/zookeeper/zookeeper.jar:/usr/lib/zookeeper/zookeeper-3.4.5-cdh5.0.0-beta-2.jar:/usr/lib/zookeeper/lib/slf4j-log4j12.jar:/usr/lib/zookeeper/lib/slf4j-api-1.7.5.jar:/usr/lib/zookeeper/lib/log4j-1.2.15.jar:/usr/lib/zookeeper/lib/slf4j-log4j12-1.7.5.jar:/usr/lib/zookeeper/lib/jline-0.9.94.jar:/usr/lib/zookeeper/lib/netty-3.2.2.Final.jar
      2014-03-20 14:43:53,893 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
      2014-03-20 14:43:53,894 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
      2014-03-20 14:43:53,894 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
      2014-03-20 14:43:53,895 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
      2014-03-20 14:43:53,896 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
      2014-03-20 14:43:53,897 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-431.3.1.el6.x86_64
      2014-03-20 14:43:53,897 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=hdfs
      2014-03-20 14:43:53,898 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/var/lib/hadoop-hdfs
      2014-03-20 14:43:53,899 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/var/lib/hadoop-hdfs
      2014-03-20 14:43:53,902 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@5a9e40d2
      2014-03-20 14:43:53,953 [myid:] - INFO  [main-SendThread(localhost.localdomain:2181):ClientCnxn$SendThread@966] - Opening socket connection to server localhost.localdomain/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
      2014-03-20 14:43:53,963 [myid:] - INFO  [main-SendThread(localhost.localdomain:2181):ClientCnxn$SendThread@849] - Socket connection established to localhost.localdomain/127.0.0.1:2181, initiating session
      2014-03-20 14:43:53,977 [myid:] - INFO  [main-SendThread(localhost.localdomain:2181):ClientCnxn$SendThread@1207] - Session establishment complete on server localhost.localdomain/127.0.0.1:2181, sessionid = 0x144dbe27e1b0013, negotiated timeout = 30000
      
      WATCHER::
      
      WatchedEvent state:SyncConnected type:None path:null
      [hadoop-ha, zookeeper]
      
      -bash-4.1$ echo $?
      0
      
      

      Attachments

        1. ZOOKEEPER-1898.patch
          62 kB
          Abraham Fine
        2. ZOOKEEPER-1898.patch
          19 kB
          Abraham Fine
        3. ZOOKEEPER-1898.patch
          16 kB
          Abraham Fine

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            abrahamfine Abraham Fine
            srinathman Srinath Mantripragada
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment