Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka, mail # dev - [jira] [Commented] (KAFKA-1025) Producer.send should provide recoverability info on failiure


Copy link to this message
-
[jira] [Commented] (KAFKA-1025) Producer.send should provide recoverability info on failiure
"Joe Stein 2014-01-10, 15:33

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

Joe Stein commented on KAFKA-1025:
----------------------------------

Hi Dima, I would say no for two reason.  As Jun says in KAFKA-998 there are places where exceptions are swallowed that would have to get looked at and also possibly reworked.  I would also argue that since 998 didn't make it into 0.8.0 that such a change (or spending time on it for 0.8.1) is (arguably) API breaking (since folks might have already built logic around exceptions and have expectations around it so doing it in the 0.8.X is not advisable).  We would not want to put out 0.8.1 and folks catching an exception for messagetolarge and doing something with it no longer can't (which would be fine though in 0.9.X for API "breaking" changes)

For this ticket I think just updating the comments for the function to say which exceptions can be thrown so folks can look at the code and know what to expect and so that the javadoc/scaladoc generation would have this information inside of it would be sufficient and helpful... for this ticket

> Producer.send should provide recoverability info on failiure
> ------------------------------------------------------------
>
>                 Key: KAFKA-1025
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1025
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>            Reporter: Jason Rosenberg
>              Labels: newbie
>
> Currently, in 0.8, the Producer.send() method either succeeds, or fails by throwing an Exception.
> There are several exceptions that can be thrown, including:
> FailedToSendException
> QueueFullException
> ClassCastExeption
> These are all sub-classes of RuntimeException.
> Under the covers, the producer will retry sending messages up to a maximum number of times (according to the message.send.max.retries property).  Internally, the producer may decide which sorts of failures are recoverable, and will retry those.  Alternatively (via an upcoming change, see KAFKA-998), it may decide to not retry at all, if the error is not recoverable.
> The problem is, if FailedToSendException is returned, the caller to Producer.send doesn't have a way to decide if a send failed due to an unrecoverable error, or failed after exhausting a maximum number of retries.
> A caller may want to decide to retry more times, perhaps after waiting a while.  But it should know first whether it's even likely that the failure is retryable.
> An example of this might be a if the message size is too large (represented internally as a MessageSizeTooLargeException).  In this case, it is not recoverable, but it is still wrapped as a FailedToSendException, and should not be retried.
> So the suggestion is to make clear in the api javadoc (or scaladoc) for Producer.send, the set of exception types that can be thrown (so that we don't have to search through source code to find them).  And add exception types, or perhaps fields within FailedToSendException, so that it's possible to reason about whether retrying might make sense.
> Currently, in addition, I've found that Producer.send can throw a QueueFullException in async mode (this should be a retryable exception, after time has elapsed, etc.), and also a ClassCastException, if there's a misconfiguration between the configured Encoder and the message data type.  I suspect there are other RuntimeExceptions that can also be thrown (e.g. NullPointerException if the message/topic are null).

--
This message was sent by Atlassian JIRA
(v6.1.5#6160)