Skip to content

Consumer doesn't raise error if "group.id" is a non-string, also doesn't get messages #1234

@rkoeninger

Description

@rkoeninger

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 polling 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() and confluent_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-more-infoIssues that require more information to cleanup.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy