Ewen Cheslack-Postava created KAFKA-2925: --------------------------------------------
Summary: 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: copycat 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)