Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-1733

Producer.send will block indeterminately when broker is unavailable.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.8.1.1
    • 0.8.2.0, 0.9.0.0
    • core, producer
    • None

    Description

      This is a follow up to the conversation here:

      https://mail-archives.apache.org/mod_mbox/kafka-dev/201409.mbox/%3CCAOG_4QYMoEJHKbo0N31+A-UjX0z5unSiSD5WbrmN-XtX7giP-Q@mail.gmail.com%3E

      During ClientUtils.fetchTopicMetadata, if the broker is unavailable, socket.connect will block indeterminately. Any retry policy (message.send.max.retries) further increases the time spent waiting for the socket to connect.

      The root fix is to add a connection timeout value to the BlockingChannel's socket configuration, like so:

      -channel.socket.connect(new InetSocketAddress(host, port))
      +channel.socket.connect(new InetSocketAddress(host, port), connectTimeoutMs)
      

      The simplest thing to do here would be to have a constant, default value that would be applied to every socket configuration.

      Is that acceptable?

      Attachments

        Activity

          People

            MarcOnSoftware Marc Chung
            MarcOnSoftware Marc Chung
            Jun Rao Jun Rao
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: