[jira] [Commented] (KAFKA-3205) Error in I/O with host (java.io.EOFException) raised in producer

2016-03-29 Thread Jonathan Bond (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15217352#comment-15217352
 ] 

Jonathan Bond commented on KAFKA-3205:
--

Our logs are being flooded with this message from the producer since we updated 
the broker to 0.9.  I was hoping somebody could review this PR to see if it is 
an acceptable solution to the problem.

> Error in I/O with host (java.io.EOFException) raised in producer
> 
>
> Key: KAFKA-3205
> URL: https://issues.apache.org/jira/browse/KAFKA-3205
> Project: Kafka
>  Issue Type: Bug
>  Components: clients
>Affects Versions: 0.8.2.1, 0.9.0.0
>Reporter: Jonathan Raffre
>
> In a situation with a Kafka broker in 0.9 and producers still in 0.8.2.x, 
> producers seems to raise the following after a variable amount of time since 
> start :
> {noformat}
> 2016-01-29 14:33:13,066 WARN [] o.a.k.c.n.Selector: Error in I/O with 
> 172.22.2.170
> java.io.EOFException: null
> at 
> org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:62)
>  ~[org.apache.kafka.kafka-clients-0.8.2.0.jar:na]
> at org.apache.kafka.common.network.Selector.poll(Selector.java:248) 
> ~[org.apache.kafka.kafka-clients-0.8.2.0.jar:na]
> at 
> org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:192) 
> [org.apache.kafka.kafka-clients-0.8.2.0.jar:na]
> at 
> org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:191) 
> [org.apache.kafka.kafka-clients-0.8.2.0.jar:na]
> at 
> org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:122) 
> [org.apache.kafka.kafka-clients-0.8.2.0.jar:na]
> at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66-internal]
> {noformat}
> This can be reproduced successfully by doing the following :
>  * Start a 0.8.2 producer connected to the 0.9 broker
>  * Wait 15 minutes, exactly
>  * See the error in the producer logs.
> Oddly, this also shows up in an active producer but after 10 minutes of 
> activity.
> Kafka's server.properties :
> {noformat}
> broker.id=1
> listeners=PLAINTEXT://:9092
> port=9092
> num.network.threads=2
> num.io.threads=2
> socket.send.buffer.bytes=1048576
> socket.receive.buffer.bytes=1048576
> socket.request.max.bytes=104857600
> log.dirs=/mnt/data/kafka
> num.partitions=4
> auto.create.topics.enable=false
> delete.topic.enable=true
> num.recovery.threads.per.data.dir=1
> log.retention.hours=48
> log.retention.bytes=524288000
> log.segment.bytes=52428800
> log.retention.check.interval.ms=6
> log.roll.hours=24
> log.cleanup.policy=delete
> log.cleaner.enable=true
> zookeeper.connect=127.0.0.1:2181
> zookeeper.connection.timeout.ms=100
> {noformat}
> Producer's configuration :
> {noformat}
>   compression.type = none
>   metric.reporters = []
>   metadata.max.age.ms = 30
>   metadata.fetch.timeout.ms = 6
>   acks = all
>   batch.size = 16384
>   reconnect.backoff.ms = 10
>   bootstrap.servers = [127.0.0.1:9092]
>   receive.buffer.bytes = 32768
>   retry.backoff.ms = 500
>   buffer.memory = 33554432
>   timeout.ms = 3
>   key.serializer = class 
> org.apache.kafka.common.serialization.StringSerializer
>   retries = 3
>   max.request.size = 500
>   block.on.buffer.full = true
>   value.serializer = class 
> org.apache.kafka.common.serialization.StringSerializer
>   metrics.sample.window.ms = 3
>   send.buffer.bytes = 131072
>   max.in.flight.requests.per.connection = 5
>   metrics.num.samples = 2
>   linger.ms = 0
>   client.id = 
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (KAFKA-3112) One incorrect bootstrap server will prevent Kafka producer from opening

2016-01-16 Thread Jonathan Bond (JIRA)
Jonathan Bond created KAFKA-3112:


 Summary: One incorrect bootstrap server will prevent Kafka 
producer from opening
 Key: KAFKA-3112
 URL: https://issues.apache.org/jira/browse/KAFKA-3112
 Project: Kafka
  Issue Type: Bug
  Components: clients
Affects Versions: 0.8.2.1
Reporter: Jonathan Bond
Priority: Critical


If any of the servers specified in bootstrap.servers are not resolvable through 
DNS the configuration is taken as an error, and the client won't start up. We 
pass in 30 possible servers, and one had an issue so the client wouldn't start. 

It would be better if the client will attempt to start if there is at least one 
server available from DNS.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (KAFKA-3112) One incorrect bootstrap server will prevent Kafka producer from opening

2016-01-16 Thread Jonathan Bond (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-3112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15103456#comment-15103456
 ] 

Jonathan Bond commented on KAFKA-3112:
--

diff --git 
a/clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPoolTest.java
 
b/clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPoolTest.java
new file mode 100644
index 000..a32ff87
--- /dev/null
+++ 
b/clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPoolTest.java
@@ -0,0 +1,188 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.clients.producer.internals;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.apache.kafka.clients.producer.BufferExhaustedException;
+import org.apache.kafka.common.metrics.Metrics;
+import org.apache.kafka.common.utils.SystemTime;
+
+public class BufferPoolTest {
+
+public static void main(String[] args) throws InterruptedException {
+
+final BufferPool bp = new BufferPool(16 * 1024 * 1024, 16384, false, 
new Metrics(), new SystemTime(),
+"metricGroupName", Collections.emptyMap());
+final AtomicLong allocated = new AtomicLong(0);
+final AtomicLong bufferFull = new AtomicLong(0);
+final long numberOfMessages = 10;
+final AtomicLong messages = new AtomicLong(numberOfMessages);
+final int threadCount = 16;
+final CountDownLatch latch = new CountDownLatch(threadCount + 1);
+final Object lock = new Object();
+final ReentrantLock rl = new ReentrantLock();
+final LinkedBlockingQueue queue = new 
LinkedBlockingQueue();
+final AtomicLong latency = new AtomicLong();
+
+Thread reaperThread = new Thread(new Runnable() {
+
+@Override
+public void run() {
+List currenlyAllocated = new 
ArrayList(2048);
+while (true) {
+
+try {
+Thread.sleep(100);
+queue.drainTo(currenlyAllocated, 2048);
+
+for (ByteBuffer byteBuffer : currenlyAllocated) {
+bp.deallocate(byteBuffer);
+}
+// System.out.println("drained 
"+currenlyAllocated.size());
+currenlyAllocated.clear();
+} catch (Exception x) {
+System.out.println(x);
+}
+}
+
+}
+});
+reaperThread.setDaemon(true);
+reaperThread.start();
+for (int i = 0; i < threadCount; i++) {
+Thread th = new Thread(new Runnable() {
+
+@Override
+public void run() {
+latch.countDown();
+try {
+
+latch.await();
+} catch (InterruptedException e) {
+// TODO Auto-generated catch block
+e.printStackTrace();
+}
+
+while (messages.getAndDecrement() > 0) {
+try {
+// synchronized (lock) {
+//
+// }
+
+// rl.lock();
+//
+// rl.unlock();
+long start = System.nanoTime();
+try {
+
+//ByteBuffer bb = bp.allocate(1000);
+// Thread.yield();
+ByteBuffer bb = allocate(bp, 1000);
+
+if (bb != null) {
+