[ https://issues.apache.org/jira/browse/KAFKA-5359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035419#comment-16035419 ]
ASF GitHub Bot commented on KAFKA-5359: --------------------------------------- GitHub user vahidhashemian opened a pull request: https://github.com/apache/kafka/pull/3213 KAFKA-5359: Make future exception the exception cause on the client side Instead of throwing `future.exception()` on the client side, throw an exception with `future.exception()` as the cause. This is to better identify where on the client side the exception is thrown. You can merge this pull request into a Git repository by running: $ git pull https://github.com/vahidhashemian/kafka KAFKA-5359 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/3213.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3213 ---- commit cee7244dc58fd48e53064f3abc6600a386b274c6 Author: Vahid Hashemian <vahidhashem...@us.ibm.com> Date: 2017-06-02T20:06:21Z KAFKA-5359: Make future exception the exception cause on the client side Instead of throwing `future.exception()` on the client side, throw an exception with that `future.exception()` as the cause. This is to better identify where on the client side the exception is thrown. ---- > Exceptions from RequestFuture lack parts of the stack trace > ----------------------------------------------------------- > > Key: KAFKA-5359 > URL: https://issues.apache.org/jira/browse/KAFKA-5359 > Project: Kafka > Issue Type: Bug > Components: clients > Reporter: Magnus Reftel > Assignee: Vahid Hashemian > Priority: Minor > > When an exception occurs within a task that reports its result using a > RequestFuture, that exception is stored in a field on the RequestFuture using > the {{raise}} method. In many places in the code where such futures are > completed, that exception is then thrown directly using {{throw > future.exception();}} (see e.g. > [Fetcher.getTopicMetadata|https://github.com/apache/kafka/blob/aebba89a2b9b5ea6a7cab2599555232ef3fe21ad/clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java#L316]). > This means that the exception that ends up in client code only has stack > traces related to the original exception, but nothing leading up to the > completion of the future. The client therefore gets no indication of what was > going on in the client code - only that it somehow ended up in the Kafka > libraries, and that a task failed at some point. > One solution to this is to use the exceptions from the future as causes for > chained exceptions, so that the client gets a stack trace that shows what the > client was doing, in addition to getting the stack traces for the exception > in the task. -- This message was sent by Atlassian JIRA (v6.3.15#6346)