Skip to content

Inconsistent producer start/stop  #938

@valq7711

Description

@valq7711

As there is self._closed = False in __init__, then it requires to call await producer.stop() even if it is not started.

producer = aiokafka.AIOKafkaProducer(bootstrap_servers="localhost:9092")
del producer  # Unclosed AIOKafkaProducer

self._closed = False
# Warn if producer was not closed properly
# We don't attempt to close the Consumer, as __del__ is synchronous
def __del__(self, _warnings=warnings):
if self._closed is False:
_warnings.warn(f"Unclosed AIOKafkaProducer {self!r}",
ResourceWarning,
source=self)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions