You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Nalin DeZoysa <nd...@tagged.com> on 2011/10/06 23:21:15 UTC

Exception causing Kafka to crash

Hi,

I'm seeing this error occasionally, that causes Kafka to crash. Does anyone
know what the cause of this error is and how can I prevent against this
happening?


Thanks,
Nalin



[2011-10-03 15:33:22,193] INFO Awaiting connections on port 9092
(kafka.network.Acceptor)
[2011-10-03 15:33:22,193] INFO Registering broker /brokers/ids/0
(kafka.server.KafkaZooKeeper)
[2011-10-03 15:33:22,229] INFO conflict in /brokers/ids/0 data:
10.98.20.109-1317681202194:10.98.20.109:9092 stored data:
10.98.20.109-1317268078266:10.98.20.109:9092 (kafka.utils.ZkUtils$)
[2011-10-03 15:33:22,230] FATAL
org.I0Itec.zkclient.exception.ZkNodeExistsException:
org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode =
NodeExists for /brokers/ids/0 (kafka.server.KafkaServer)
[2011-10-03 15:33:22,231] FATAL
org.I0Itec.zkclient.exception.ZkNodeExistsException:
org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode =
NodeExists for /brokers/ids/0
    at org.I0Itec.zkclient.exception.ZkException.create(ZkException.java:55)
    at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:685)
    at org.I0Itec.zkclient.ZkClient.create(ZkClient.java:304)
    at org.I0Itec.zkclient.ZkClient.createEphemeral(ZkClient.java:328)
    at kafka.utils.ZkUtils$.createEphemeralPath(ZkUtils.scala:55)
    at
kafka.utils.ZkUtils$.createEphemeralPathExpectConflict(ZkUtils.scala:71)
    at
kafka.server.KafkaZooKeeper.registerBrokerInZk(KafkaZooKeeper.scala:54)
    at kafka.log.LogManager.startup(LogManager.scala:122)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:77)
    at
kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:40)
    at kafka.Kafka$.main(Kafka.scala:56)
    at kafka.Kafka.main(Kafka.scala)
Caused by: org.apache.zookeeper.KeeperException$NodeExistsException:
KeeperErrorCode = NodeExists for /brokers/ids/0
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:110)
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:42)
    at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:637)
    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)
    ... 10 more
 (kafka.server.KafkaServer)
[2011-10-03 15:33:22,231] INFO Shutting down... (kafka.server.KafkaServer)
[2011-10-03 15:33:22,232] INFO shutdown scheduler kafka-logcleaner-
(kafka.utils.KafkaScheduler)
[2011-10-03 15:33:22,239] INFO shutdown scheduler kafka-logflusher-
(kafka.utils.KafkaScheduler)
[2011-10-03 15:33:22,481] INFO zkActor stopped (kafka.log.LogManager)
[2011-10-03 15:33:22,482] INFO Closing zookeeper client...
(kafka.server.KafkaZooKeeper)
[2011-10-03 15:33:22,482] INFO Terminate ZkClient event thread.
(org.I0Itec.zkclient.ZkEventThread)
[2011-10-03 15:33:22,486] INFO Session: 0x132b34a9a89006a closed
(org.apache.zookeeper.ZooKeeper)
[2011-10-03 15:33:22,486] INFO shut down completed
(kafka.server.KafkaServer)

Re: Exception causing Kafka to crash

Posted by Chris Burroughs <ch...@gmail.com>.
On 10/07/2011 01:47 PM, Taylor Gautier wrote:
> Oh, I think I found it :
> 
> zk.sessiontimeout.ms

Correct, that's how Kafka passes in the zookeeper client setting for
session timeouts.  Kafka servers, clients, and producers are all clients
of ZooKeeper and could (if you had some reason to) have their own
zk.sessiontimeout.ms.

Note that ZooKeeper server settings affect minimum timeout values:
http://zookeeper.apache.org/doc/r3.3.3/zookeeperAdmin.html

Re: Exception causing Kafka to crash

Posted by Taylor Gautier <tg...@tagged.com>.
Oh, I think I found it :

zk.sessiontimeout.ms

On Fri, Oct 7, 2011 at 10:44 AM, Taylor Gautier <tg...@tagged.com> wrote:

> Thanks Jay,
>
> I looked around but it wasn't immediately obvious to me what setting to
> change to reduce the zk ephemeral timeout - does kafka configure zk itself -
> if so then I'm looking for a kafka setting?  I didn't see anything
> appropriate…
>
>
>
> On Fri, Oct 7, 2011 at 9:21 AM, Jay Kreps <ja...@gmail.com> wrote:
>
>> It occurs to me that we could do a better job with this error. There are
>> really three things that might have happened (1) you restarted kafka
>> within
>> the zk timeout, in which case as far as zk is concerned your old broker
>> still exists...this is weird but actually correct behavior, (2) you have
>> two
>> brokers with the same id, (3) zk has a bug and is not deleting ephemeral
>> nodes.
>>
>> I think if we just improved the error message to explain this we would
>> have
>> happier users, as is it requires slightly deep knowledge of zk to
>> understand
>> why this happens.
>>
>> -Jay
>>
>> On Fri, Oct 7, 2011 at 7:35 AM, Mathias Herberts <
>> mathias.herberts@gmail.com
>> > wrote:
>>
>> > If you abort Kafka (killing the JVM for example) and restart it,
>> > depending on the zookeeper timeout you've used, it might occur that
>> > the ephemeral node create by the broker has not yet been removed by
>> > ZK.
>> >
>> > If this is the case, Kafka will detect that there is a znode conflict
>> > and kill itself.
>> >
>> > This is what your logs seem to imply:
>> >
>> > [2011-10-03 15:33:22,229] INFO conflict in /brokers/ids/0 data:
>> > 10.98.20.109-1317681202194:10.98.20.109:9092 stored data:
>> > 10.98.20.109-1317268078266:10.98.20.109:9092 (kafka.utils.ZkUtils$)
>> >
>> > Try to either wait for more than the ZK timeout prior to restarting
>> > Kafka, or lower the ZK timeout so the ephemeral node is indeed gone
>> > when you restart Kafka.
>> >
>> > Mathias.
>> >
>>
>
>

Re: Exception causing Kafka to crash

Posted by Taylor Gautier <tg...@tagged.com>.
Thanks Jay,

I looked around but it wasn't immediately obvious to me what setting to
change to reduce the zk ephemeral timeout - does kafka configure zk itself -
if so then I'm looking for a kafka setting?  I didn't see anything
appropriate…



On Fri, Oct 7, 2011 at 9:21 AM, Jay Kreps <ja...@gmail.com> wrote:

> It occurs to me that we could do a better job with this error. There are
> really three things that might have happened (1) you restarted kafka within
> the zk timeout, in which case as far as zk is concerned your old broker
> still exists...this is weird but actually correct behavior, (2) you have
> two
> brokers with the same id, (3) zk has a bug and is not deleting ephemeral
> nodes.
>
> I think if we just improved the error message to explain this we would have
> happier users, as is it requires slightly deep knowledge of zk to
> understand
> why this happens.
>
> -Jay
>
> On Fri, Oct 7, 2011 at 7:35 AM, Mathias Herberts <
> mathias.herberts@gmail.com
> > wrote:
>
> > If you abort Kafka (killing the JVM for example) and restart it,
> > depending on the zookeeper timeout you've used, it might occur that
> > the ephemeral node create by the broker has not yet been removed by
> > ZK.
> >
> > If this is the case, Kafka will detect that there is a znode conflict
> > and kill itself.
> >
> > This is what your logs seem to imply:
> >
> > [2011-10-03 15:33:22,229] INFO conflict in /brokers/ids/0 data:
> > 10.98.20.109-1317681202194:10.98.20.109:9092 stored data:
> > 10.98.20.109-1317268078266:10.98.20.109:9092 (kafka.utils.ZkUtils$)
> >
> > Try to either wait for more than the ZK timeout prior to restarting
> > Kafka, or lower the ZK timeout so the ephemeral node is indeed gone
> > when you restart Kafka.
> >
> > Mathias.
> >
>

Re: Exception causing Kafka to crash

Posted by Neha Narkhede <ne...@gmail.com>.
Good point, Jay!

I filed a JIRA to address this - https://issues.apache.org/jira/browse/KAFKA-150

Thanks,
Neha

On Fri, Oct 7, 2011 at 9:21 AM, Jay Kreps <ja...@gmail.com> wrote:
> It occurs to me that we could do a better job with this error. There are
> really three things that might have happened (1) you restarted kafka within
> the zk timeout, in which case as far as zk is concerned your old broker
> still exists...this is weird but actually correct behavior, (2) you have two
> brokers with the same id, (3) zk has a bug and is not deleting ephemeral
> nodes.
>
> I think if we just improved the error message to explain this we would have
> happier users, as is it requires slightly deep knowledge of zk to understand
> why this happens.
>
> -Jay
>
> On Fri, Oct 7, 2011 at 7:35 AM, Mathias Herberts <mathias.herberts@gmail.com
>> wrote:
>
>> If you abort Kafka (killing the JVM for example) and restart it,
>> depending on the zookeeper timeout you've used, it might occur that
>> the ephemeral node create by the broker has not yet been removed by
>> ZK.
>>
>> If this is the case, Kafka will detect that there is a znode conflict
>> and kill itself.
>>
>> This is what your logs seem to imply:
>>
>> [2011-10-03 15:33:22,229] INFO conflict in /brokers/ids/0 data:
>> 10.98.20.109-1317681202194:10.98.20.109:9092 stored data:
>> 10.98.20.109-1317268078266:10.98.20.109:9092 (kafka.utils.ZkUtils$)
>>
>> Try to either wait for more than the ZK timeout prior to restarting
>> Kafka, or lower the ZK timeout so the ephemeral node is indeed gone
>> when you restart Kafka.
>>
>> Mathias.
>>
>

Re: Exception causing Kafka to crash

Posted by Jay Kreps <ja...@gmail.com>.
It occurs to me that we could do a better job with this error. There are
really three things that might have happened (1) you restarted kafka within
the zk timeout, in which case as far as zk is concerned your old broker
still exists...this is weird but actually correct behavior, (2) you have two
brokers with the same id, (3) zk has a bug and is not deleting ephemeral
nodes.

I think if we just improved the error message to explain this we would have
happier users, as is it requires slightly deep knowledge of zk to understand
why this happens.

-Jay

On Fri, Oct 7, 2011 at 7:35 AM, Mathias Herberts <mathias.herberts@gmail.com
> wrote:

> If you abort Kafka (killing the JVM for example) and restart it,
> depending on the zookeeper timeout you've used, it might occur that
> the ephemeral node create by the broker has not yet been removed by
> ZK.
>
> If this is the case, Kafka will detect that there is a znode conflict
> and kill itself.
>
> This is what your logs seem to imply:
>
> [2011-10-03 15:33:22,229] INFO conflict in /brokers/ids/0 data:
> 10.98.20.109-1317681202194:10.98.20.109:9092 stored data:
> 10.98.20.109-1317268078266:10.98.20.109:9092 (kafka.utils.ZkUtils$)
>
> Try to either wait for more than the ZK timeout prior to restarting
> Kafka, or lower the ZK timeout so the ephemeral node is indeed gone
> when you restart Kafka.
>
> Mathias.
>

Re: Exception causing Kafka to crash

Posted by Chris Burroughs <ch...@gmail.com>.
On 10/07/2011 10:35 AM, Mathias Herberts wrote:
> Try to either wait for more than the ZK timeout prior to restarting
> Kafka, or lower the ZK timeout so the ephemeral node is indeed gone
> when you restart Kafka.

There are tradeoffs involved when setting a lower timeout [1].  So as
other's have said there are other things (like a clean shutdown) to try
first.


[1] http://markmail.org/message/634m6gxrjjo7kded


Re: Exception causing Kafka to crash

Posted by Jun Rao <ju...@gmail.com>.
Another way is to do the clean shutdown, instead of the force shutdown. This
will cause the ZK client to be closed and all ephemeral nodes created by
this client removed.

Jun

On Fri, Oct 7, 2011 at 7:35 AM, Mathias Herberts <mathias.herberts@gmail.com
> wrote:

> If you abort Kafka (killing the JVM for example) and restart it,
> depending on the zookeeper timeout you've used, it might occur that
> the ephemeral node create by the broker has not yet been removed by
> ZK.
>
> If this is the case, Kafka will detect that there is a znode conflict
> and kill itself.
>
> This is what your logs seem to imply:
>
> [2011-10-03 15:33:22,229] INFO conflict in /brokers/ids/0 data:
> 10.98.20.109-1317681202194:10.98.20.109:9092 stored data:
> 10.98.20.109-1317268078266:10.98.20.109:9092 (kafka.utils.ZkUtils$)
>
> Try to either wait for more than the ZK timeout prior to restarting
> Kafka, or lower the ZK timeout so the ephemeral node is indeed gone
> when you restart Kafka.
>
> Mathias.
>

Re: Exception causing Kafka to crash

Posted by Mathias Herberts <ma...@gmail.com>.
If you abort Kafka (killing the JVM for example) and restart it,
depending on the zookeeper timeout you've used, it might occur that
the ephemeral node create by the broker has not yet been removed by
ZK.

If this is the case, Kafka will detect that there is a znode conflict
and kill itself.

This is what your logs seem to imply:

[2011-10-03 15:33:22,229] INFO conflict in /brokers/ids/0 data:
10.98.20.109-1317681202194:10.98.20.109:9092 stored data:
10.98.20.109-1317268078266:10.98.20.109:9092 (kafka.utils.ZkUtils$)

Try to either wait for more than the ZK timeout prior to restarting
Kafka, or lower the ZK timeout so the ephemeral node is indeed gone
when you restart Kafka.

Mathias.