[ https://issues.apache.org/jira/browse/KAFKA-2925?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Yokota resolved KAFKA-2925. ---------------------------------- Resolution: Cannot Reproduce I wasn't able to reproduce the NPE and by reviewing the code it doesn't seem possible any longer. Closing this as cannot reproduce. > 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: Robert Yokota > 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 (v7.6.3#76005)