[
https://issues.apache.org/jira/browse/FLINK-6311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15975433#comment-15975433
]
ASF GitHub Bot commented on FLINK-6311:
---------------------------------------
Github user tzulitai commented on a diff in the pull request:
https://github.com/apache/flink/pull/3738#discussion_r112302446
--- Diff:
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java
---
@@ -408,12 +408,15 @@ public void runFetcher() throws Exception {
*/
public void shutdownFetcher() {
running = false;
- mainThread.interrupt(); // the main thread may be sleeping for
the discovery interval
-
+ if (mainThread != null) {
+ mainThread.interrupt(); // the main thread may be
sleeping for the discovery interval
+ }
if (LOG.isInfoEnabled()) {
LOG.info("Shutting down the shard consumer threads of
subtask {} ...", indexOfThisConsumerSubtask);
}
- shardConsumersExecutor.shutdownNow();
+ if (shardConsumersExecutor != null) {
--- End diff --
Actually I think this is a redundant `null` check, because
`shardConsumersExecutor` is final.
It should never be null, so this null check might actually be confusing to
other readers.
> NPE in FlinkKinesisConsumer if source was closed before run
> -----------------------------------------------------------
>
> Key: FLINK-6311
> URL: https://issues.apache.org/jira/browse/FLINK-6311
> Project: Flink
> Issue Type: Bug
> Components: Kinesis Connector
> Reporter: Tzu-Li (Gordon) Tai
> Assignee: mingleizhang
>
> This was reported by an user:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Flink-errors-out-and-job-fails-IOException-from-CollectSink-open-td12606.html
> The {{shutdownFetcher}} method of {{KinesisDataFetcher}} is not protected
> against the condition when the source was closed before it started running.
> Both {{mainThread}} and {{shardConsumersExecutor}} should have null checks.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)