gpt4 book ai didi

java - kafkaserver shutdown 在单元测试中无限期挂起(kafka 从 0.8.1.1 升级到 0.8.2.0)

转载 作者:行者123 更新时间:2023-12-02 04:58:55 35 4
gpt4 key购买 nike

我们最近从 kafka 0.8.1.1 升级到 0.8.2.0。我们的集成测试失败,因为测试无限期地卡在 kafkaServer.shutdown() 上

这些是我的经纪人设置

Properties brokerProps = new Properties();
brokerProps.put("zookeeper.connect", "127.0.0.1:8888");
brokerProps.put("port", "9092");
brokerProps.setProperty("num.partitions", "10");
brokerProps.setProperty("broker.id", "1");
brokerProps.setProperty("log.dirs", "some log dir");
brokerProps.setProperty("advertised.host.name", "127.0.0.1");
KafkaConfig config = new KafkaConfig(brokerProps);

这是我看到的堆栈跟踪

 ERROR [kafka-network-thread-9092-0] kafka.network.Processor - Closing socket for /127.0.0.1 because of error
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[na:1.8.0_25]
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) ~[na:1.8.0_25]
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) ~[na:1.8.0_25]
at sun.nio.ch.IOUtil.write(IOUtil.java:65) ~[na:1.8.0_25]
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:470) ~[na:1.8.0_25]
at kafka.api.PartitionDataSend.writeTo(FetchResponse.scala:68) ~[kafka_2.10-0.8.2.0.jar:na]
at kafka.network.MultiSend.writeTo(Transmission.scala:101) ~[kafka_2.10-0.8.2.0.jar:na]
at kafka.api.TopicDataSend.writeTo(FetchResponse.scala:125) ~[kafka_2.10-0.8.2.0.jar:na]
at kafka.network.MultiSend.writeTo(Transmission.scala:101) ~[kafka_2.10-0.8.2.0.jar:na]
at kafka.api.FetchResponseSend.writeTo(FetchResponse.scala:231) ~[kafka_2.10-0.8.2.0.jar:na]
at kafka.network.Processor.write(SocketServer.scala:472) ~[kafka_2.10-0.8.2.0.jar:na]
at kafka.network.Processor.run(SocketServer.scala:342) ~[kafka_2.10-0.8.2.0.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]

最佳答案

发现问题所在。我们在关闭 kafkaserver 之前先关闭了 ZK。 KafkaServer 无限期地等待,尝试获取与 zkClient 的连接。 改变顺序有效。

关于java - kafkaserver shutdown 在单元测试中无限期挂起(kafka 从 0.8.1.1 升级到 0.8.2.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28486471/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com