Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroying kafka triggers 100 ms sleep #1895

Closed
6 of 7 tasks
Tezd opened this issue Jul 24, 2018 · 2 comments
Closed
6 of 7 tasks

Destroying kafka triggers 100 ms sleep #1895

Tezd opened this issue Jul 24, 2018 · 2 comments

Comments

@Tezd
Copy link

Tezd commented Jul 24, 2018

Description

Destroying rdkafka adds 100 ms latency due to rdkafka_broker.c line of code rd_usleep(100*1000/*100ms*/, &rk->rk_terminate); Those changes were made in 1c044abc59063fab56001d016b44d54374a67b2a commit with message about memory leak. Is there any way of avoiding these 100 ms sleep or I am hitting it due to some misconfiguration?

How to reproduce

  1. Bring up environment with docker and docker-compose as follows:
version: "3.6"

services:
  zookeeper:
    image: zookeeper:3.4.11

  kafka:
    image: wurstmeister/kafka:1.0.0
    environment:
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_BROKER_ID: 42
    depends_on:
      - zookeeper
    ports:
      - 9092:9092
  1. Add rd_rkb_dbg(rkb, GENERIC, "SLEEP", "Sleeping for 100 ms"); before https://github.com/edenhill/librdkafka/blob/master/src/rdkafka_broker.c#L3562 to verify that we are hitting that condition.
  2. modify examples/rdkafka_simple_producer.c as follows:
    rdkafka_simple_producer.c
  3. cd ${LIBRDKAFKA_DIR}/examples && make rdkafka_simple_producer
  4. time ./rdkafka_simple_producer 127.0.0.1 test
  5. Verify that it sleeps for 100 ms

Checklist

Please provide the following information:

  • librdkafka version (release number or git tag): v.0.11.5
  • Apache Kafka version: 1.0.0
  • librdkafka client configuration: debug=all
  • Operating system: Ubuntu 16.04.1
  • Provide logs (with debug=.. as necessary) from librdkafka
    librdkafka.log
  • Provide broker log excerpts (they are empty for test run but will provide startup logs)
    brokers.log
  • Critical issue
@rnpridgeon
Copy link

At a glance this does not look to be avoidable with configuration changes. I'll take a deeper look and get back to you though.

@edenhill
Copy link
Contributor

edenhill commented Aug 7, 2018

Thank you for a great report!

I don't think that sleep is necessary any more, it was there to protect from a tight reconnect loop on protocol errors, but we have reconnect.backoff.jitter.ms to slow things down instead.

Will fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants