[ https://issues.apache.org/jira/browse/KAFKA-8882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16932295#comment-16932295 ]
Jakub commented on KAFKA-8882: ------------------------------ hi [~vvcephei] , thanks for your answer. Here are all state transitions that I'm getting: {code:java} INFO: State transition from CREATED to REBALANCING INFO: State transition from REBALANCING to RUNNING INFO: State transition from RUNNING to ERROR INFO: State transition from ERROR to PENDING_SHUTDOWN {code} After that all I see is {code:java} Connection to node 0 (localhost/127.0.0.1:9092) could not be established. Broker may not be available {code} and once in a while {code:java} Metadata update failed org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. {code} "Already in the pending shutdown state, wait to complete shutdown" is not displayed. > It's not possible to restart Kafka Streams using StateListener > -------------------------------------------------------------- > > Key: KAFKA-8882 > URL: https://issues.apache.org/jira/browse/KAFKA-8882 > Project: Kafka > Issue Type: Bug > Components: streams > Affects Versions: 2.2.1 > Environment: Linux, Windows > Reporter: Jakub > Priority: Major > > Upon problems with connecting to a Kafka Cluster services using Kafka Streams > stop working with the following error message: > {code:java} > Encountered the following unexpected Kafka exception during processing, this > usually indicate Streams internal errors (...) > Caused by: org.apache.kafka.common.errors.TimeoutException: Aborted due to > timeout > (...) > State transition from PENDING_SHUTDOWN to DEAD > (...) > All stream threads have died. The instance will be in error state and should > be closed. > {code} > > We tried to use a StateListener to automatically detect and work around this > problem. > However, this approach doesn't seem to work correctly: > # KafkaStreams correctly transitions from status Error to Pending Shutdown, > but then it stays in this status forever. > # Occasionally, after registering a listener the status doesn't even change > to Error. > > {code:java} > kafkaStreams.setStateListener(new StateListener() { > public void onChange(State stateNew, State stateOld) { > if (stateNew == State.ERROR) { > kafkaStreams.cleanUp(); > kafkaStreams.close(); > > } else if (stateNew == State.PENDING_SHUTDOWN) { > > // this message is displayed, and then nothig else > happens > LOGGER.info("State is PENDING_SHUTDOWN"); > > } else if (stateNew == State.NOT_RUNNING) { > // it never gets here > kafkaStreams = createKafkaStreams(); > kafkaStreams.start(); > } > } > }); > {code} > > Surprisingly, restarting KafkaStreams outside of a listener works fine. > I'm happy to provide more details if required. -- This message was sent by Atlassian Jira (v8.3.4#803005)