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

        Hide
        Jun Rao added a comment -

        Are you using namespace in ZK connection string? If so, the typical problem is that the namespace is not present. You have to manually create the namespace in ZK.

        Show
        Jun Rao added a comment - Are you using namespace in ZK connection string? If so, the typical problem is that the namespace is not present. You have to manually create the namespace in ZK.
        Hide
        Thomas Dudziak added a comment -

        Ah I see, this is very non-descriptive error then. Maybe you could add this to the documentation/FAQ (or make the error more descriptive) ?

        Show
        Thomas Dudziak added a comment - Ah I see, this is very non-descriptive error then. Maybe you could add this to the documentation/FAQ (or make the error more descriptive) ?
        Hide
        Jay Kreps added a comment -

        I think we can fix this so it gives a more intuitive error message that explains the problem. No one will be able to figure this out otherwise.

        Show
        Jay Kreps added a comment - I think we can fix this so it gives a more intuitive error message that explains the problem. No one will be able to figure this out otherwise.
        Hide
        Jason Rosenberg added a comment -

        This issue happens also in 0.8.0
        It would be even better, if the chroot is not present in zk, that it be automatically created, thus avoiding this issue altogether.

        Show
        Jason Rosenberg added a comment - This issue happens also in 0.8.0 It would be even better, if the chroot is not present in zk, that it be automatically created, thus avoiding this issue altogether.
        Hide
        Jun Rao added a comment -

        We can auto-create it, but then we can't prevent config mistakes. We can probably start by just providing a more meaningful error. One way is to just catch IllegalArgumentException with that message and covert it to a more meaningful exception (and message). Jason, you want to give this a shot?

        Show
        Jun Rao added a comment - We can auto-create it, but then we can't prevent config mistakes. We can probably start by just providing a more meaningful error. One way is to just catch IllegalArgumentException with that message and covert it to a more meaningful exception (and message). Jason, you want to give this a shot?
        Hide
        Gwen Shapira added a comment -

        With KAFKA-404 committed, this is resolved too.

        Show
        Gwen Shapira added a comment - With KAFKA-404 committed, this is resolved too.
        Hide
        ASF GitHub Bot added a comment -

        Github user fsaintjacques closed the pull request at:

        https://github.com/apache/kafka/pull/2

        Show
        ASF GitHub Bot added a comment - Github user fsaintjacques closed the pull request at: https://github.com/apache/kafka/pull/2

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development