-
Notifications
You must be signed in to change notification settings - Fork 922
Description
Description
(Enhancement suggestion; addition to work done in #506 )
While doing some testing, I tried using a generated group id to easily get messages from the beginning:
consumer = Consumer({
"bootstrap.servers": "my-server",
"security.protocol": "SASL_SSL",
"sasl.mechanisms": "PLAIN",
"sasl.username": "my-username",
"sasl.password": "my-password",
"group.id": uuid4()
})
I forgot to str
the UUID. Passing a non-string group id allowed the Consumer
to be created and polled without error but never returned any messages. Calling str
on the UUID fixed it like: str(uuid4())
.
The code modified in PR #506 could be further modified to apply the PyObject_Str
function to coerce the group.id
to a string or a type check to confirm it is a string (raise error if not) before passing the value onto the underlying C library.
In my case, a PyObject*
referring to a uuid.UUID
was passed to librdkafka
and undefined behavior happened.
How to reproduce
Try poll
ing from a topic using a non-string group.id
like the code above. poll
should timeout every time, returning None
.
Checklist
Please provide the following information:
- confluent-kafka-python and librdkafka version (
confluent_kafka.version()
andconfluent_kafka.libversion()
):confluent_kafka.version()
=('1.7.0', 17235968)
confluent_kafka.libversion()
=('1.7.0', 17236223)
- Apache Kafka broker version:
- using Confluent Cloud
- Client configuration:
{...}
- example given above
- Operating system:
- Windows 10
- Provide client logs (with
'debug': '..'
as necessary) - Provide broker log excerpts