Kafka
  1. Kafka
  2. KAFKA-294

"Path length must be > 0" error during startup

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8.2.0
    • Component/s: None
    • Labels:
      None

      Description

      When starting Kafka 0.7.0 using zkclient-0.1.jar, I get this error:

      INFO 2012-03-06 02:39:04,072 main kafka.server.KafkaZooKeeper Registering broker /brokers/ids/1
      FATAL 2012-03-06 02:39:04,111 main kafka.server.KafkaServer Fatal error during startup.
      java.lang.IllegalArgumentException: Path length must be > 0
      at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:48)
      at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:35)
      at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:620)
      at org.I0Itec.zkclient.ZkConnection.create(ZkConnection.java:87)
      at org.I0Itec.zkclient.ZkClient$1.call(ZkClient.java:308)
      at org.I0Itec.zkclient.ZkClient$1.call(ZkClient.java:304)
      at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:675)
      at org.I0Itec.zkclient.ZkClient.create(ZkClient.java:304)
      at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:213)
      at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:223)
      at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:223)
      at kafka.utils.ZkUtils$.createParentPath(ZkUtils.scala:48)
      at kafka.utils.ZkUtils$.createEphemeralPath(ZkUtils.scala:60)
      at kafka.utils.ZkUtils$.createEphemeralPathExpectConflict(ZkUtils.scala:72)
      at kafka.server.KafkaZooKeeper.registerBrokerInZk(KafkaZooKeeper.scala:57)
      at kafka.log.LogManager.startup(LogManager.scala:124)
      at kafka.server.KafkaServer.startup(KafkaServer.scala:80)
      at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:47)
      at kafka.Kafka$.main(Kafka.scala:60)
      at kafka.Kafka.main(Kafka.scala)

      The problem seems to be this code in ZkClient's createPersistent method:

      String parentDir = path.substring(0, path.lastIndexOf('/'));
      createPersistent(parentDir, createParents);
      createPersistent(path, createParents);

      which doesn't check for whether parentDir is an empty string, which it will become for /brokers/ids/1 after two recursions.

        Activity

        Thomas Dudziak created issue -
        Thomas Dudziak made changes -
        Field Original Value New Value
        Description When starting Kafka 0.7.0 using zkclient-0.1.jar, I get this error:

        {noformat}
        INFO 2012-03-06 02:39:04,072 main kafka.server.KafkaZooKeeper Registering broker /brokers/ids/1
        FATAL 2012-03-06 02:39:04,111 main kafka.server.KafkaServer Fatal error during startup.
        java.lang.IllegalArgumentException: Path length must be > 0
                at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:48)
                at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:35)
                at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:620)
                at org.I0Itec.zkclient.ZkConnection.create(ZkConnection.java:87)
                at org.I0Itec.zkclient.ZkClient$1.call(ZkClient.java:308)
                at org.I0Itec.zkclient.ZkClient$1.call(ZkClient.java:304)
                at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:675)
                at org.I0Itec.zkclient.ZkClient.create(ZkClient.java:304)
                at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:213)
                at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:223)
                at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:223)
                at kafka.utils.ZkUtils$.createParentPath(ZkUtils.scala:48)
                at kafka.utils.ZkUtils$.createEphemeralPath(ZkUtils.scala:60)
                at kafka.utils.ZkUtils$.createEphemeralPathExpectConflict(ZkUtils.scala:72)
                at kafka.server.KafkaZooKeeper.registerBrokerInZk(KafkaZooKeeper.scala:57)
                at kafka.log.LogManager.startup(LogManager.scala:124)
                at kafka.server.KafkaServer.startup(KafkaServer.scala:80)
                at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:47)
                at kafka.Kafka$.main(Kafka.scala:60)
                at kafka.Kafka.main(Kafka.scala)
        {noformat}

        The problem seems to be this code in {{ZkClient}}'s {{createPersistent}} method:

        {code:java}
        String parentDir = path.substring(0, path.lastIndexOf('/'));
        createPersistent(parentDir, createParents);
        createPersistent(path, createParents);
        {code}
        which doesn't check for whether {{parentDir}} is an empty string, which it will become for {{/brokers/ids/1}} after two recursions.
        When starting Kafka 0.7.0 using zkclient-0.1.jar, I get this error:

        INFO 2012-03-06 02:39:04,072 main kafka.server.KafkaZooKeeper Registering broker /brokers/ids/1
        FATAL 2012-03-06 02:39:04,111 main kafka.server.KafkaServer Fatal error during startup.
        java.lang.IllegalArgumentException: Path length must be > 0
                at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:48)
                at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:35)
                at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:620)
                at org.I0Itec.zkclient.ZkConnection.create(ZkConnection.java:87)
                at org.I0Itec.zkclient.ZkClient$1.call(ZkClient.java:308)
                at org.I0Itec.zkclient.ZkClient$1.call(ZkClient.java:304)
                at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:675)
                at org.I0Itec.zkclient.ZkClient.create(ZkClient.java:304)
                at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:213)
                at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:223)
                at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:223)
                at kafka.utils.ZkUtils$.createParentPath(ZkUtils.scala:48)
                at kafka.utils.ZkUtils$.createEphemeralPath(ZkUtils.scala:60)
                at kafka.utils.ZkUtils$.createEphemeralPathExpectConflict(ZkUtils.scala:72)
                at kafka.server.KafkaZooKeeper.registerBrokerInZk(KafkaZooKeeper.scala:57)
                at kafka.log.LogManager.startup(LogManager.scala:124)
                at kafka.server.KafkaServer.startup(KafkaServer.scala:80)
                at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:47)
                at kafka.Kafka$.main(Kafka.scala:60)
                at kafka.Kafka.main(Kafka.scala)

        The problem seems to be this code in ZkClient's createPersistent method:

        String parentDir = path.substring(0, path.lastIndexOf('/'));
        createPersistent(parentDir, createParents);
        createPersistent(path, createParents);

        which doesn't check for whether parentDir is an empty string, which it will become for /brokers/ids/1 after two recursions.
        Thomas Dudziak made changes -
        Resolution Invalid [ 6 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Jay Kreps made changes -
        Resolution Invalid [ 6 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Gwen Shapira made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Gwen Shapira made changes -
        Fix Version/s 0.8.2 [ 12326167 ]
        Tony Stevenson made changes -
        Workflow no-reopen-closed, patch-avail [ 12656722 ] Apache Kafka Workflow [ 13051126 ]
        Tony Stevenson made changes -
        Workflow Apache Kafka Workflow [ 13051126 ] no-reopen-closed, patch-avail [ 13053535 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Thomas Dudziak
          • Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development