Skip to content

threads not getting cleaned up #1803

@vk-coder

Description

@vk-coder

Read the FAQ first: https://github.com/edenhill/librdkafka/wiki/FAQ

Description

If broker communication is not established threads don't get cleaned up

How to reproduce

  1. Create producer with broker ip which is not yet started.
  2. Similarly create consumer with broker ip which is not yet started.
  3. fetch metadata using consumer->metadata , which would return error
  4. delete producer and consumer
  5. repeat from beginning

IMPORTANT: Always try to reproduce the issue on the latest released version (see https://github.com/edenhill/librdkafka/releases), if it can't be reproduced on the latest version the issue has been fixed.

Checklist

IMPORTANT: We will close issues where the checklist has not been completed.

Please provide the following information:

  • librdkafka version (release number or git tag): 0.11.0
  • Apache Kafka version: <REPLACE with e.g., 0.10.2.3>
  • librdkafka client configuration:
    Producer config
    conf->set("metadata.broker.list", brokers, errstr);
    conf->set("dr_cb", delivery_cb, errstr);
    conf->set("event_cb", event_cb, errstr);
    conf->set("log_level", "0", errstr);
    conf->set("client.id", m_kafka_client_id, errstr);

consumer config
conf->set("metadata.broker.list", brokers, errstr);
conf->set("bootstrap.servers", brokers, errstr);
conf->set("topic.metadata.refresh.interval.ms","3000", errstr);
conf->set("default_topic_conf", tconf.get(), errstr);
conf->set("log_level", "0", errstr);
conf->set("group.id", group_id, errstr);
conf->set("client.id", m_kafka_client_id, errstr);
conf->set("auto.offset.reset", "earliest", errstr);
conf->set("rebalance_cb", rebalance_cb, errstr);
conf->set("statistics.interval.ms", "3000", errstr);
conf->set("event_cb", event_cb, errstr);

  • Operating system: CentOS Linux release 7.4.1708 (Core)

  • Provide logs (with debug=.. as necessary) from librdkafka
    LOG-7-WAKEUPFD: [thrd:app]: 10.60.11.3:9092/bootstrap: Enabled low-latency partition queue wake-ups
    LOG-7-BRKMAIN: [thrd::0/internal]: :0/internal: Enter main broker thread
    LOG-7-WAKEUPFD: [thrd:app]: 10.60.11.3:9092/bootstrap: Enabled low-latency ops queue wake-ups
    LOG-7-STATE: [thrd::0/internal]: :0/internal: Broker changed state INIT -> UP
    LOG-7-BROADCAST: [thrd::0/internal]: Broadcasting state change
    LOG-7-BROKER: [thrd:app]: 10.60.11.3:9092/bootstrap: Added new broker with NodeId -1
    LOG-7-TOPIC: [thrd:app]: New local topic: test1-b
    LOG-7-BRKMAIN: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: Enter main broker thread
    LOG-7-TOPPARNEW: [thrd:app]: NEW test1-b [-1] 0x1eb6e10 (at rd_kafka_topic_new0:282)
    LOG-7-CONNECT: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: broker in state INIT connecting
    LOG-7-METADATA: [thrd:app]: Skipping metadata refresh of 1 topic(s): no usable brokers
    LOG-7-TOPIC: [thrd:app]: New local topic: test1-u
    LOG-7-TOPPARNEW: [thrd:app]: NEW test1-u [-1] 0x1eb29e0 (at rd_kafka_topic_new0:282)
    LOG-7-METADATA: [thrd:app]: Skipping metadata refresh of 1 topic(s): no usable brokers
    LOG-7-CONNECT: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: Connecting to ipv4#10.60.11.3:9092 (plaintext) with socket 11
    LOG-7-STATE: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: Broker changed state INIT -> CONNECT
    LOG-7-BROADCAST: [thrd:10.60.11.3:9092/bootstrap]: Broadcasting state change
    LOG-7-NOINFO: [thrd:main]: Topic test1-b partition count is zero: should refresh metadata
    LOG-7-NOINFO: [thrd:main]: Topic test1-u partition count is zero: should refresh metadata
    LOG-7-METADATA: [thrd:main]: Skipping metadata refresh of 2 topic(s): no usable brokers
    LOG-7-NOINFO: [thrd:main]: Topic test1-b partition count is zero: should refresh metadata
    LOG-7-NOINFO: [thrd:main]: Topic test1-u partition count is zero: should refresh metadata
    LOG-7-METADATA: [thrd:main]: Skipping metadata refresh of 2 topic(s): no usable brokers
    LOG-7-NOINFO: [thrd:main]: Topic test1-b partition count is zero: should refresh metadata
    LOG-7-NOINFO: [thrd:main]: Topic test1-u partition count is zero: should refresh metadata
    LOG-7-METADATA: [thrd:main]: Skipping metadata refresh of 2 topic(s): no usable brokers
    LOG-7-NOINFO: [thrd:main]: Topic test1-b partition count is zero: should refresh metadata
    LOG-7-NOINFO: [thrd:main]: Topic test1-u partition count is zero: should refresh metadata
    LOG-7-METADATA: [thrd:main]: Skipping metadata refresh of 2 topic(s): no usable brokers
    LOG-7-NOINFO: [thrd:main]: Topic test1-b partition count is zero: should refresh metadata
    LOG-7-NOINFO: [thrd:main]: Topic test1-u partition count is zero: should refresh metadata
    LOG-7-METADATA: [thrd:main]: Skipping metadata refresh of 2 topic(s): no usable brokers
    LOG-7-DESTROY: [thrd:app]: Terminating instance
    LOG-7-TERMINATE: [thrd:app]: Interrupting timers
    LOG-7-TERMINATE: [thrd:app]: Sending TERMINATE to main background thread
    LOG-7-BROADCAST: [thrd:app]: Broadcasting state change
    LOG-7-TERMINATE: [thrd:app]: Joining main background thread
    LOG-7-DESTROY: [thrd:main]: Destroy internal
    LOG-7-DESTROY: [thrd:main]: Removing all topics
    LOG-7-TOPPARREMOVE: [thrd:main]: Removing toppar test1-b [-1] 0x1eb6e10
    LOG-7-DESTROY: [thrd:main]: test1-b [-1]: 0x1eb6e10 DESTROY_FINAL
    LOG-7-TOPPARREMOVE: [thrd:main]: Removing toppar test1-u [-1] 0x1eb29e0
    LOG-7-DESTROY: [thrd:main]: test1-u [-1]: 0x1eb29e0 DESTROY_FINAL
    LOG-7-TERMINATE: [thrd:main]: Purging reply queue
    LOG-7-TERMINATE: [thrd:main]: Decommissioning internal broker
    LOG-7-TERMINATE: [thrd:main]: Join 2 broker thread(s)
    LOG-7-TERMINATE: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: Handle is terminating: failed 0 request(s) in retry+outbuf
    LOG-7-BROKERFAIL: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: failed: err: Local: Broker handle destroyed: (errno: Operation now in progress)
    LOG-7-STATE: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: Broker changed state CONNECT -> DOWN
    LOG-7-BROADCAST: [thrd:10.60.11.3:9092/bootstrap]: Broadcasting state change
    LOG-7-BUFQ: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: Purging bufq with 0 buffers
    LOG-7-BUFQ: [thrd:10.60.11.3:9092/bootstrap]: 10.60.11.3:9092/bootstrap: Updating 0 buffers on connection reset
    LOG-7-TERMINATE: [thrd::0/internal]: :0/internal: Handle is terminating: failed 0 request(s) in retry+outbuf
    LOG-7-BROKERFAIL: [thrd::0/internal]: :0/internal: failed: err: Local: Broker handle destroyed: (errno: Success)
    LOG-7-STATE: [thrd::0/internal]: :0/internal: Broker changed state UP -> DOWN
    LOG-7-BROADCAST: [thrd::0/internal]: Broadcasting state change
    LOG-7-BUFQ: [thrd::0/internal]: :0/internal: Purging bufq with 0 buffers
    LOG-7-BUFQ: [thrd::0/internal]: :0/internal: Updating 0 buffers on connection reset
    LOG-7-TERMINATE: [thrd:main]: Main background thread exiting
    LOG-7-TERMINATE: [thrd:app]: Destroying op queues
    LOG-7-TERMINATE: [thrd:app]: Termination done: freeing resources

  • Provide broker log excerpts

  • Critical issue

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