Chris Egerton created KAFKA-8058: ------------------------------------ Summary: ConnectRestExtensionContext does not return list of connectors from its ConnectClusterState Key: KAFKA-8058 URL: https://issues.apache.org/jira/browse/KAFKA-8058 Project: Kafka Issue Type: Bug Components: KafkaConnect Affects Versions: 2.1.1, 2.1.0, 2.0.1, 2.0.0 Reporter: Chris Egerton Assignee: Chris Egerton
Title is not entirely accurate, but describes the most common way this bug presents itself. The [ConnectClusterStateImpl|https://github.com/apache/kafka/blob/ab00c51b6362b41071ae32611ebf698ba9c221ee/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/health/ConnectClusterStateImpl.java] used by Kafka Connect to provide cluster information to REST extensions makes an asynchronous call to [Herder.connectors(...)|https://github.com/apache/kafka/blob/ab00c51b6362b41071ae32611ebf698ba9c221ee/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Herder.java#L70] in its [connectors()|https://github.com/apache/kafka/blob/ab00c51b6362b41071ae32611ebf698ba9c221ee/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/health/ConnectClusterStateImpl.java#L46] method that populates a list of connector names, then immediately returns that list of connector names. If the list is read soon after it is returned, it's possible it will be empty or at least not completely populated. Since the method is implicitly synchronous (no callback logic is involved in its parameters or return values, and there is no documentation indicating asynchronous behavior for the [ConnectClusterState.connectors()|https://github.com/apache/kafka/blob/ab00c51b6362b41071ae32611ebf698ba9c221ee/connect/api/src/main/java/org/apache/kafka/connect/health/ConnectClusterState.java#L28-L34] method), this should be remedied by adding a wait for the Herder.connectors(...) method to complete in the ConnectClusterStateImpl.connectors() method. -- This message was sent by Atlassian JIRA (v7.6.3#76005)