You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Ewen Cheslack-Postava (JIRA)" <ji...@apache.org> on 2016/06/15 17:38:09 UTC

[jira] [Commented] (KAFKA-2925) NullPointerException if FileStreamSinkTask is stopped before initialization finishes

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

Ewen Cheslack-Postava commented on KAFKA-2925:
----------------------------------------------

[~hachikuji] Can you remember if we've gotten the start()/stop() behavior into better shape now such that this isn't possible? I remember a few patches around that ordering.

> NullPointerException if FileStreamSinkTask is stopped before initialization finishes
> ------------------------------------------------------------------------------------
>
>                 Key: KAFKA-2925
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2925
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 0.9.0.0
>            Reporter: Ewen Cheslack-Postava
>            Assignee: Ewen Cheslack-Postava
>            Priority: Minor
>
> If a FileStreamSinkTask is stopped too quickly after a distributed herder rebalances work, it can result in cleanup happening without start() ever being called:
> {quote}
> Sink task org.apache.kafka.connect.runtime.WorkerSinkTask@f9ac651 was stopped before completing join group. Task initialization and start is being skipped (org.apache.kafka.connect.runtime.WorkerSinkTask:150)
> {quote}
> This is actually a bit weird since stop() is still called so resources allocated in the constructor can be cleaned up, but possibly unexpected that stop() will be called without start() ever being called.
> Because the code in FileStreamSinkTask's stop() method assumes start() has been called, it can result in a NullPointerException because it assumes the PrintStream is already initialized.
> The easy fix is to check for nulls before closing. However, we should probably also consider whether the current possibly sequence of events is confusing and if we shoud not invoke stop() and make it clear in the SInkTask interface that you should only initialize stuff in the constructor that won't need any manual cleanup later.



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