Closed
Description
When doing
async def kafka_consumer():
while True:
message = await asyncio.to_thread(consumer.poll, timeout=timeout)
If I trigger a cancellation on kafka_consumer
, on Windows I get a Segmentation Fault.
I have this workaround for now
async def _poll_message(consumer: Consumer, timeout:float = 1.0) -> None | Message:
if sys.platform == "win32":
return consumer.poll(timeout=0.200)
else:
return asyncio.to_thread(consumer.poll, timeout=timeout)
UPDATE: here's how I start up Kafka locally in a docker compose
services:
kafka:
image: confluentinc/cp-kafka
ports:
- "9092:9092"
environment:
CLUSTER_ID: 1
KAFKA_NODE_ID: 1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9091,PLAINTEXT_HOST://0.0.0.0:9092,CONTROLLER://kafka:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9091,PLAINTEXT_HOST://localhost:9092
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:9093'
KAFKA_PROCESS_ROLES: 'broker,controller'
KAFKA_LOG4J_OPTS: "-Dlog4j.rootLogger=WARN,stdout"
Metadata
Metadata
Assignees
Labels
No labels