You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Andras Hatvani (JIRA)" <ji...@apache.org> on 2014/09/27 18:13:34 UTC

[jira] [Commented] (KAFKA-1494) Failed to send messages after 3 tries.

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

Andras Hatvani commented on KAFKA-1494:
---------------------------------------

As a workaround increase retry.backoff.ms from the default 100 ms to 1000 ms.
In case this would be not enough for you, you can try to change the values of 
- message.send.max.retries from the default 5 to e.g. 10 and
- topic.metadata.refresh.interval.ms to 0.

This is the expected behavior, therefore an exception mustn't be thrown, rather it has to be communicated that the leader election is in progress. Furthermore, suggestions regarding changing the values variables I mentioned should be mandatory.

> Failed to send messages after 3 tries.
> --------------------------------------
>
>                 Key: KAFKA-1494
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1494
>             Project: Kafka
>          Issue Type: Bug
>          Components: controller, core
>    Affects Versions: 0.8.1.1
>         Environment: Mac OS 
>            Reporter: darion yaphets
>            Assignee: Neha Narkhede
>
> I use default server & zookeeper config to start-up zookeeper server and kafka broker on my machine to test custom message which based on proto buffer . I write a client to send protobuf-message to kafka broker and source code as following :
>                 Properties properties = new Properties();
> 		properties.put("serializer.class", "java_example.ProtoBufMessage");
> 		properties.put("metadata.broker.list", "localhost:9092");
> 		ProducerConfig config = new ProducerConfig(properties);
> 		testBuf buffer = testBuf.newBuilder().setID(0)
> 				.setUrl("darion.yaphet.org").build();
> 		Producer<String, testBuf> producer = new Producer<String, testBuf>(
> 				config);
> 		producer.send(new KeyedMessage<String, testBuf>("protobuffer", buffer));
> client debug log report a exception:
> [FileSystemMoniter] INFO [main] kafka.utils.Logging$class.info(68) | Disconnecting from localhost:9092
> [FileSystemMoniter] DEBUG [main] kafka.utils.Logging$class.debug(52) | Successfully fetched metadata for 1 topic(s) Set(protobuffer)
> [FileSystemMoniter] WARN [main] kafka.utils.Logging$class.warn(83) | Error while fetching metadata [{TopicMetadata for topic protobuffer -> 
> No partition metadata for topic protobuffer due to kafka.common.LeaderNotAvailableException}] for topic [protobuffer]: class kafka.common.LeaderNotAvailableException 
> [FileSystemMoniter] ERROR [main] kafka.utils.Logging$class.error(97) | Failed to send requests for topics protobuffer with correlation ids in [0,8]
> Exception in thread "main" kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
> 	at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:90)
> 	at kafka.producer.Producer.send(Producer.scala:76)
> 	at kafka.javaapi.producer.Producer.send(Producer.scala:33)
> 	at java_example.ProducerExamples.main(ProducerExamples.java:26)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)