[ https://issues.apache.org/jira/browse/KAFKA-5697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16452916#comment-16452916 ]
ASF GitHub Bot commented on KAFKA-5697: --------------------------------------- vvcephei opened a new pull request #4930: KAFKA-5697: issue Consumer#wakeup during Streams shutdown URL: https://github.com/apache/kafka/pull/4930 Wakeup consumers during shutdown to break them out of any internally blocking calls. Semantically, it should be fine to treat a WakeupException as "no work to do", which will then continue the threads' polling loops, leading them to discover that they are supposed to shut down, which they will do gracefully. The existing tests should be sufficient to verify no regressions. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > StreamThread.shutdown() need to interrupt the stream threads to break the loop > ------------------------------------------------------------------------------ > > Key: KAFKA-5697 > URL: https://issues.apache.org/jira/browse/KAFKA-5697 > Project: Kafka > Issue Type: Bug > Components: streams > Reporter: Guozhang Wang > Assignee: John Roesler > Priority: Major > Labels: newbie > > In {{StreamThread.shutdown()}} we currently do nothing but set the state, > hoping the stream thread may eventually check it and shutdown itself. > However, under certain scenarios the thread may get blocked within a single > loop and hence will never check on this state enum. For example, it's > {{consumer.poll}} call trigger {{ensureCoordinatorReady()}} which will block > until the coordinator can be found. If the coordinator broker is never up and > running then the Stream instance will be blocked forever. > A simple way to produce this issue is to start the work count demo without > starting the ZK / Kafka broker, and then it will get stuck in a single loop > and even `ctrl-C` will not stop it since its set state will never be read by > the thread: > {code:java} > [2017-08-03 15:17:39,981] WARN Connection to node -1 could not be > established. Broker may not be available. > (org.apache.kafka.clients.NetworkClient) > [2017-08-03 15:17:40,046] WARN Connection to node -1 could not be > established. Broker may not be available. > (org.apache.kafka.clients.NetworkClient) > [2017-08-03 15:17:40,101] WARN Connection to node -1 could not be > established. Broker may not be available. > (org.apache.kafka.clients.NetworkClient) > [2017-08-03 15:17:40,206] WARN Connection to node -1 could not be > established. Broker may not be available. > (org.apache.kafka.clients.NetworkClient) > [2017-08-03 15:17:40,261] WARN Connection to node -1 could not be > established. Broker may not be available. > (org.apache.kafka.clients.NetworkClient) > [2017-08-03 15:17:40,366] WARN Connection to node -1 could not be > established. Broker may not be available. > (org.apache.kafka.clients.NetworkClient) > [2017-08-03 15:17:40,472] WARN Connection to node -1 could not be > established. Broker may not be available. > (org.apache.kafka.clients.NetworkClient) > ^C[2017-08-03 15:17:40,580] WARN Connection to node -1 could not be > established. Broker may not be available. > (org.apache.kafka.clients.NetworkClient) > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)