title: Kafka consumer fetching metadata for topics failed
body: <p>I am attempting to write a Java client for a third party's Kafka and ZooKeeper servers. I am able to list and describe topics, but when I attempt to read any, a <code>ClosedChannelException</code> is raised. I reproduce them here with the command line client.</p>
  
  <pre><code>$ bin/kafka-console-consumer.sh --zookeeper 255.255.255.255:2181 --topic eventbustopic
  [2015-06-02 16:23:04,375] WARN Fetching topic metadata with correlation id 0 for topics [Set(eventbustopic)] from broker [id:1,host:SOME_HOST,port:9092] failed (kafka.client.ClientUtils$)
  java.nio.channels.ClosedChannelException                                       
      at kafka.network.BlockingChannel.send(BlockingChannel.scala:100)           
      at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:73)        
      at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(SyncProducer.scala:72)
      at kafka.producer.SyncProducer.send(SyncProducer.scala:113)                
      at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:58)        
      at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:93)        
      at kafka.consumer.ConsumerFetcherManager$LeaderFinderThread.doWork(ConsumerFetcherManager.scala:66)
      at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:60)         
  [2015-06-02 16:23:04,515] WARN Fetching topic metadata with correlation id 0 for topics [Set(eventbustopic)] from broker [id:0,host:SOME_HOST,port:9092] failed (kafka.client.ClientUtils$)
  java.nio.channels.ClosedChannelException                                       
      at kafka.network.BlockingChannel.send(BlockingChannel.scala:100)           
      at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:73)        
      at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(SyncProducer.scala:72)
      at kafka.producer.SyncProducer.send(SyncProducer.scala:113)                
      at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:58)        
      at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:93)        
      at kafka.consumer.ConsumerFetcherManager$LeaderFinderThread.doWork(ConsumerFetcherManager.scala:66)
      at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:60)         
  </code></pre>
  
  <p>Alternate commands succeed:</p>
  
  <pre><code>$ bin/kafka-topics.sh --describe --zookeeper 255.255.255.255:2181 --topic eventbustopic
  Topic:eventbustopic   PartitionCount:2        ReplicationFactor:1     Configs:
      Topic: eventbustopic  Partition: 0    Leader: 1       Replicas: 1     Isr: 1
      Topic: eventbustopic  Partition: 1    Leader: 0       Replicas: 0     Isr: 0
  
  $ bin/kafka-topics.sh --list --zookeeper 255.255.255.255:2181 --topic eventbustopic
  eventbustopic
  </code></pre>
  
  <p>(The ips were redacted and replaced with 255.255.255.255)</p>
  
  <p>When I google this exception, I see issues on the producer side -- indeed, the source for <code>ClientUtils.fetchTopicMetadata</code> suggests this is mainly used by producers. </p>
  
  <p>One concern that I have is that this might be a product of the network layout: the packets are mangled by Haproxy and sent over a VPN. </p>
  
  <p>What exactly is at work here? </p>