Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python confluent-kafka package return returns "Disconnected while requesting ApiVersion" on macOS #1239

Closed
2 tasks
upsilon-den opened this issue Nov 19, 2021 · 3 comments

Comments

@upsilon-den
Copy link

Description

confluent-kafka-python==1.7.0
librdkafka==1.7.0
client_configuration = {
'group.id': 'test',
"bootstrap.servers": "my-external-host:9092"
"security.protocol": PLAINTEXT
}
operating system = macOS

Each time get the error Disconnected while requesting ApiVersion
All other tools like Kafka tool or python package like kafka-python ware working, but confluent-kafka for some reasons - not

No any security.protocols, all is PLAINTEXT

May someone gives me advice?

logs

%7|1637327168.507|BROKER|rdkafka#consumer-1| [thrd:app]: GroupCoordinator: Added new broker with NodeId -1 %7|1637327168.507|BROKER|rdkafka#consumer-1| [thrd:app]: my-external-host:9092/bootstrap: Added new broker with NodeId -1 %7|1637327168.507|BRKMAIN|rdkafka#consumer-1| [thrd:GroupCoordinator]: GroupCoordinator: Enter main broker thread %7|1637327168.507|BRKMAIN|rdkafka#consumer-1| [thrd::0/internal]: :0/internal: Enter main broker thread %7|1637327168.507|INIT|rdkafka#consumer-1| [thrd:app]: librdkafka v1.7.0 (0x10700ff) rdkafka#consumer-1 initialized (builtin.features gzip,snappy,ssl,sasl,regex,lz4,sasl_gssapi,sasl_plain,sasl_scram,plugins,zstd,sasl_oauthbearer, STRIP STATIC_LINKING CC GXX PKGCONFIG OSXLD LIBDL PLUGINS ZLIB SSL SASL_CYRUS ZSTD HDRHISTOGRAM SNAPPY SOCKEM SASL_SCRAM SASL_OAUTHBEARER CRC32C_HW, debug 0x2) %7|1637327168.507|CONNECT|rdkafka#consumer-1| [thrd:main]: my-external-host:9092/bootstrap: Selected for cluster connection: coordinator query (broker has 0 connection attempt(s)) %7|1637327168.507|BRKMAIN|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Enter main broker thread %7|1637327168.507|CONNECT|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Received CONNECT op %7|1637327168.507|STATE|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Broker changed state INIT -> TRY_CONNECT %7|1637327168.507|CONNECT|rdkafka#consumer-1| [thrd:app]: Not selecting any broker for cluster connection: still suppressed for 49ms: application metadata request %7|1637327168.507|CONNECT|rdkafka#consumer-1| [thrd:app]: Not selecting any broker for cluster connection: still suppressed for 49ms: application metadata request %7|1637327168.507|CONNECT|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: broker in state TRY_CONNECT connecting %7|1637327168.507|STATE|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Broker changed state TRY_CONNECT -> CONNECT %7|1637327168.507|CONNECT|rdkafka#consumer-1| [thrd:app]: Not selecting any broker for cluster connection: still suppressed for 49ms: application metadata request %7|1637327168.509|CONNECT|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Connecting to ipv4#10.103.68.24:9092 (plaintext) with socket 11 %7|1637327168.578|CONNECT|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Connected to ipv4#10.103.68.24:9092 %7|1637327168.578|CONNECTED|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Connected (#1) %7|1637327168.578|FEATURE|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Updated enabled protocol features +ApiVersion to ApiVersion %7|1637327168.578|STATE|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Broker changed state CONNECT -> APIVERSION_QUERY %7|1637327168.578|CONNECT|rdkafka#consumer-1| [thrd:app]: Cluster connection already in progress: application metadata request %7|1637327168.580|FAIL|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Disconnected while requesting ApiVersion: might be caused by incorrect security.protocol configuration (connecting to a SSL listener?) or broker version is < 0.10 (see api.version.request) (after 2ms in state APIVERSION_QUERY) (_TRANSPORT) %6|1637327168.580|FAIL|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Disconnected while requesting ApiVersion: might be caused by incorrect security.protocol configuration (connecting to a SSL listener?) or broker version is < 0.10 (see api.version.request) (after 2ms in state APIVERSION_QUERY) %7|1637327168.580|FEATURE|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Updated enabled protocol features -ApiVersion to %7|1637327168.580|STATE|rdkafka#consumer-1| [thrd:my-external-host:9092/bootstrap]: my-external-host:9092/bootstrap: Broker changed state APIVERSION_QUERY -> DOWN

How to reproduce

`
from confluent_kafka import Consumer

c = Consumer(
{
'group.id': 'test',
"bootstrap.servers": "my-external-host:9092",
}
)`
c.list_topics()

Checklist

Please provide the following information:

  • [* ] confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()):
  • [ *] Apache Kafka broker version:
  • [ *] Client configuration: {...}
  • [ *] Operating system:
  • [ *] Provide client logs (with 'debug': '..' as necessary)
  • Provide broker log excerpts
  • Critical issue
@jliunyu
Copy link
Contributor

jliunyu commented Feb 8, 2022

According to https://github.com/edenhill/librdkafka/blob/master/src/rdkafka_broker.c#L411 and the error you saw Disconnected while requesting ApiVersion: might be caused by incorrect security.protocol configuration (connecting to a SSL listener?) or broker version is < 0.10 (see api.version.request) (after 2ms in state APIVERSION_QUERY), there maybe two reasons caused the Disconnected error:

  1. Your broker version is < 0.10.
  2. You are trying connecting to a SSL-listener as PLAINTEXT.

I didn't see your broker version here, if it's smaller than 0.10, please update your broker version. Otherwise the second reason caused your issue.

@ilayilter
Copy link

I have same issue what is the solution of this

@dgoldenberg-ias
Copy link

Same issue here. What is it about MacOS vs. Linux that makes this different? Something at the socket level..? I'm having a similar issue with kafka-python dpkp/kafka-python#2450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants