[英]Spring-Cloud-Stream Kafka Azure - Unexpected error code 13 while fetching data
I'm developing a SpringBoot app dockerized. 我正在开发dockerized的SpringBoot应用程序。 The docker images are microservices and one of these communicate with Azure Event Hub.
docker映像是微服务,其中之一与Azure Event Hub通信。
Some of my properties: 我的一些属性:
spring-boot -> 2.0.7.RELEASE
春季引导-> 2.0.7.RELEASE
spring-cloud.version -> Finchley.SR2
spring-cloud.version-> Finchley.SR2
I've created a topic in Azure(with Kafka enabled ). 我已经在Azure中创建了一个主题( 启用Kafka )。
I've follow some simple guide to set up my microservice and everything works fine. 我遵循了一些简单的指南来设置我的微服务,并且一切正常。
@EnableBinding({Processor.class})
public class EventService {
...
@Autowired private Processor ehProcessor;
...
public void send(String event) {
Message<String> message = MessageBuilder
.withPayload(event)
.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON)
.build();
boolean send = ehProcessor.output().send(message, 5000L);
if (!send) {
log.error("Event NOT sent", event);
}
}
...
@StreamListener(target = Processor.INPUT)
public void receive(String event) {
handle(event);
}
}
For an entire month everything goes fine but in the last two days the microservice stucks because a continuous stacktrace is filling all my disc (a solution was to set up a docker log rotation). 一整个月的时间一切都很好,但是在最近的两天中,微服务卡住了,因为连续的堆栈跟踪填充了我的所有磁盘(解决方案是设置docker日志轮换)。
java.lang.IllegalStateException: Unexpected error code 13 while fetching data
at org.apache.kafka.clients.consumer.internals.Fetcher.parseCompletedFetch(Fetcher.java:891) ~[kafka-clients-1.0.1.jar!/:na]
at org.apache.kafka.clients.consumer.internals.Fetcher.fetchedRecords(Fetcher.java:528) ~[kafka-clients-1.0.1.jar!/:na]
at org.apache.kafka.clients.consumer.KafkaConsumer.pollOnce(KafkaConsumer.java:1154) ~[kafka-clients-1.0.1.jar!/:na]
at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1111) ~[kafka-clients-1.0.1.jar!/:na]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:699) ~[spring-kafka-2.1.7.RELEASE.jar!/:2.1.7.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_181]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_181]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
I'm talking about 8/9 log messsage in 1 ms. 我说的是1毫秒内的8/9日志消息。
Looking inside the org.apache.kafka.common.protocol.Errors class the error is related to: 在org.apache.kafka.common.protocol.Errors类内部查看,该错误与以下内容有关:
NETWORK_EXCEPTION(13, "The server disconnected before a response was received."
NETWORK_EXCEPTION(13,“服务器在收到响应之前已断开连接。”
I'm not able to reproduce programmatically this error. 我无法以编程方式重现此错误。 I don't understand why when the first error is arised the log will start and no stop in infinite loop.
我不明白为什么在出现第一个错误时日志将开始并且在无限循环中不停止。 I need to stop the docker container and sometimes the container will not stop.
我需要停止docker容器,有时容器不会停止。 The only solution is to remove the container and recreate again.
唯一的解决方案是删除容器,然后重新创建。
UPDATE 更新
I've open an issue on github here . 我开过一个问题,在github 这里 。 I've already received a response and they are starting to investigate on it.
我已经收到了回复,他们开始对此进行调查。
UPDATE 更新
The problem has been fixed. 该问题已解决。
When they changed an UnknownServerException to a NetworkException, Spring Boot started getting stuck in the retry loop.
当他们将UnknownServerException更改为NetworkException时,Spring Boot开始陷入重试循环。
It has confirm in this link that, 它已在此链接中确认,
There was a recent change where an instance of UnknownServerException was changed to a NetworkException. 最近发生了更改,将UnknownServerException的实例更改为NetworkException。
Issue details are here - https://github.com/Azure/azure-event-hubs-for-kafka/issues - with your namespace info. 问题详细信息在这里-https://github.com/Azure/azure-event-hubs-for-kafka/issues-以及您的命名空间信息。 Thanks!
谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.