[ https://issues.apache.org/jira/browse/KAFKA-6893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471130#comment-16471130 ]
ASF GitHub Bot commented on KAFKA-6893: --------------------------------------- hachikuji closed pull request #4999: KAFKA-6893: Create processors before starting acceptor in SocketServer URL: https://github.com/apache/kafka/pull/4999 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/core/src/main/scala/kafka/network/SocketServer.scala b/core/src/main/scala/kafka/network/SocketServer.scala index 27d89b48a72..639f79936a1 100644 --- a/core/src/main/scala/kafka/network/SocketServer.scala +++ b/core/src/main/scala/kafka/network/SocketServer.scala @@ -146,10 +146,10 @@ class SocketServer(val config: KafkaConfig, val metrics: Metrics, val time: Time val securityProtocol = endpoint.securityProtocol val acceptor = new Acceptor(endpoint, sendBufferSize, recvBufferSize, brokerId, connectionQuotas) + addProcessors(acceptor, endpoint, processorsPerListener) KafkaThread.nonDaemon(s"kafka-socket-acceptor-$listenerName-$securityProtocol-${endpoint.port}", acceptor).start() acceptor.awaitStartup() acceptors.put(endpoint, acceptor) - addProcessors(acceptor, endpoint, processorsPerListener) } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Processors created after acceptor started which can cause in a brief refusal > to accept connections > --------------------------------------------------------------------------------------------------- > > Key: KAFKA-6893 > URL: https://issues.apache.org/jira/browse/KAFKA-6893 > Project: Kafka > Issue Type: Bug > Affects Versions: 1.1.0 > Reporter: Ryan P > Assignee: Rajini Sivaram > Priority: Minor > > The acceptor starts before the the processor threads are actually created > which creates a very small window in which connections to the broker will > fail. When the acceptor takes on a new connection an illegal arithmetic > exception is thrown as shown below. > > Exception: / by zero > at kafka.network.Acceptor.run(SocketServer.scala:391) > at java.lang.Thread.run(Thread.java:748) > [2018-05-09 15:34:05,153] ERROR Error while accepting connection > (kafka.network.Acceptor) > java.lang.ArithmeticException: / by zero > at kafka.network.Acceptor.run(SocketServer.scala:391) > at java.lang.Thread.run(Thread.java:748) > [2018-05-09 15:34:05,153] ERROR Error while accepting connection > (kafka.network.Acceptor) > java.lang.ArithmeticException: / by zero > at kafka.network.Acceptor.run(SocketServer.scala:391) > at java.lang.Thread.run(Thread.java:748) > [2018-05-09 15:34:05,153] INFO Awaiting socket connections on > lontkfk02.mwam.local:9093. (kafka.network.Acceptor) > [2018-05-09 15:34:05,268] INFO [SocketServer brokerId=2] Started 2 acceptor > threads (kafka.network.SocketServer) > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)