Using the highlevel KafkaConsumer or KafkaProducer with Kafka 2.6.0 configured with an SSL listener ends with multiple client disconnection. The messages are produced/consumed eventually.
[2020-11-03 12:25:24,686] DEBUG [ReplicaFetcher replicaId=2, leaderId=1, fetcherId=0] Sending FETCH request with header RequestHeader(apiKey=FETCH, apiVersion=11, clientId=broker-2-fetcher-0, correlationId=1897) and timeout 30000 to node 1: {replica_id=2,max_wait_time=500,min_bytes=1,max_bytes=10485760,isolation_level=0,session_id=383646810,session_epoch=1895,topics=[],forgotten_topics_data=[],rack_id=} (org.apache.kafka.clients.NetworkClient)
[2020-11-03 12:25:24,693] DEBUG [SocketServer brokerId=2] Connection with /0:0:0:0:0:0:0:1 disconnected (org.apache.kafka.common.network.Selector)
java.io.IOException: Broken pipe
at java.base/sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:113)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:79)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
at org.apache.kafka.common.network.SslTransportLayer.flush(SslTransportLayer.java:239)
at org.apache.kafka.common.network.SslTransportLayer.write(SslTransportLayer.java:697)
at org.apache.kafka.common.network.SslTransportLayer.write(SslTransportLayer.java:738)
at org.apache.kafka.common.network.SslTransportLayer.write(SslTransportLayer.java:763)
at org.apache.kafka.common.network.ByteBufferSend.writeTo(ByteBufferSend.java:60)
at org.apache.kafka.common.record.MultiRecordsSend.writeTo(MultiRecordsSend.java:93)
at org.apache.kafka.common.network.KafkaChannel.write(KafkaChannel.java:425)
at org.apache.kafka.common.network.Selector.write(Selector.java:648)
at org.apache.kafka.common.network.Selector.attemptWrite(Selector.java:641)
at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:597)
at org.apache.kafka.common.network.Selector.poll(Selector.java:485)
at kafka.network.Processor.poll(SocketServer.scala:913)
at kafka.network.Processor.run(SocketServer.scala:816)
at java.base/java.lang.Thread.run(Thread.java:834)
[2020-11-03 12:25:24,693] DEBUG [SslTransportLayer channelId=0:0:0:0:0:0:0:1:29092-0:0:0:0:0:0:0:1:38210-28 key=channel=java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:29092 remote=/0:0:0:0:0:0:0:1:38210], selector=sun.nio.ch.EPollSelectorImpl@68dbbefc, interestOps=1, readyOps=0] Failed to send SSL Close message (org.apache.kafka.common.network.SslTransportLayer)
java.io.IOException: Broken pipe
at java.base/sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:113)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:79)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
at org.apache.kafka.common.network.SslTransportLayer.flush(SslTransportLayer.java:239)
at org.apache.kafka.common.network.SslTransportLayer.close(SslTransportLayer.java:182)
at org.apache.kafka.common.utils.Utils.closeAll(Utils.java:934)
at org.apache.kafka.common.network.KafkaChannel.close(KafkaChannel.java:154)
at org.apache.kafka.common.network.Selector.doClose(Selector.java:955)
at org.apache.kafka.common.network.Selector.close(Selector.java:939)
at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:629)
at org.apache.kafka.common.network.Selector.poll(Selector.java:485)
at kafka.network.Processor.poll(SocketServer.scala:913)
at kafka.network.Processor.run(SocketServer.scala:816)
at java.base/java.lang.Thread.run(Thread.java:834)
[2020-11-03 12:25:25,117] DEBUG [ReplicaFetcher replicaId=2, leaderId=3, fetcherId=0] Received FETCH response from node 3 for request with header RequestHeader(apiKey=FETCH, apiVersion=11, clientId=broker-2-fetcher-0, correlationId=1897): org.apache.kafka.common.requests.FetchResponse@40c845b8 (org.apache.kafka.clients.NetworkClient)
Description
Using the highlevel KafkaConsumer or KafkaProducer with Kafka 2.6.0 configured with an SSL listener ends with multiple client disconnection. The messages are produced/consumed eventually.
It looks like the socket is closed after the BrokerConnection callback method invokes the _conn_state_change method.
This only happens if SSL is used, I wasn't able to reproduce using PLAINTEXT.
I checked with confluent-kafka python library and it seems to be working fine.
It doesn't happen with previous Kafka versions.
How to reproduce
Code snippet:
Error returned:
Kafka Brokers errors:
Checklist
Thanks for your help!