Skip to content

Crash (SEGV) in Producer class #1590

@joaoe

Description

@joaoe

Description

In my project I derived a new class from Producer to either implement a Mock producer for unit tests or a local Producer that just took snapshots of messages to a local cache.

The code looked like this

class MyProducer(Producer):
    def __init__(self, config):
        # Don't call super().__init__()
        self._config = config

MyProducer().flush()

and then everything crashed.

Looking at the code, the Producer class internally is represented by Handle which has a rk property. This is set to NULL until __init__ is called, but a lot of the Handle code lacks NULL checks.

How to reproduce

See code example above.

Checklist

Please provide the following information:

  • confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()): master
  • Apache Kafka broker version:
  • Client configuration: {...}
  • Operating system:
  • Provide client logs (with 'debug': '..' as necessary)
  • Provide broker log excerpts
  • Critical issue

Metadata

Metadata

Assignees

Labels

code:CIssues that are specific to C behavior or domain within the library independent of library logicenhancementRequesting a feature changemaintenanceAny tech debt or routine action tasks that should be tracked with an issuepriority:highMaintainer triage tag for indicating high impact or criticality issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions