c++ kafka 客户端rdkafka报Receive failed: Disconnected问题原因以及解决方法

%3|1538976114.812|FAIL|rdkafka#producer-1| [thrd:kafka-server:9092/bootstrap]: kafka-server:9092/0: Receive failed: Disconnected
%3|1538976114.812|ERROR|rdkafka#producer-1| [thrd:kafka-server:9092/bootstrap]: kafka-server:9092/0: Receive failed: Disconnected
%3|1538976114.812|ERROR|rdkafka#producer-1| [thrd:kafka-server:9092/bootstrap]: 1/1 brokers are down

原因:

Why am I seeing Receive failed: Disconnected?

If the remote peer, typically the broker (but could also be an active TCP gateway of some kind), closes the connection you‘ll see a log message like this:

%3|1500588440.537|FAIL|rdkafka#producer-1| 10.255.84.150:9092/1: Receive failed: Disconnected

There are a number of possible reasons, in order of how common they are:

  • Broker‘s idle connection reaper closes the connection due to inactivity. This is controlled by the broker configuration property connections.max.idle.ms and defaults to 10 minutes. This is by far the most common reason for spontaneous disconnects.
  • The client sent an unsupported protocol request; see Broker version compatibility. This is considered a configuration error on the client. The broker should log an exception explaining why the connection was closed, see the broker logs.
  • The client sent a malformed protocol request; this is an indication of a bug in the client. The broker should log an exception explaining why the connection was closed, see the broker logs.
  • The broker is in an invalid state. The broker should log an exception explaining why the connection was closed, see the broker logs.
  • TCP gateway/load-balancer/firewall session timeout. Try enabling TCP keep-alives on the client by setting socket.keepalive.enable=true.

Since a TCP close can‘t signal why the remote peer closed the connection there is no way for the client to know what went wrong. If the disconnect logs are getting annoying and the admin deems they are caused by the idle connection reaper, the log.connection.close client configuration property can be set to false to silence all spontaneous disconnect logs.

NOTE: Whenever a connection is closed for whatever reason, librdkafka will automatically reconnect after reconnect.backoff.jitter.ms (default 500ms).

简单的说,其中之一是服务器会kill掉10分钟空闲的连接,librdkafka会在连接断开后500毫秒内重连。所以,根本解决方法就是没事每分钟发个心跳信息。

参考:https://github.com/edenhill/librdkafka/wiki/FAQ#why-am-i-seeing-receive-failed-disconnected

原文地址:https://www.cnblogs.com/zhjh256/p/9753806.html

时间: 2024-08-25 09:46:55

c++ kafka 客户端rdkafka报Receive failed: Disconnected问题原因以及解决方法的相关文章

loadrunner 运行javavuser报错Failed to get JRE version解决方法

报错信息 Error: Failed to get JRE version. Check that your PATH environment variable contains <JDK>\bin directory.   [MsgId: MERR-22986] Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize [MsgId: MWAR-10485] Err

启动elasticsearch报错的几种原因及解决方法

ERROR: [1] bootstrap checks failed [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 解决: 在宿主机执行: sysctl -w vm.max_map_count=262144 原因: vm.max_map_count参数,是允许一个进程在VMAs拥有最大数量(VMA:虚拟内存地址, 一个连续的虚拟地址空间),当进程占用

NSLocalizedDescription=Request failed: unacceptable content-type: text/html 解决方法

使用AFNetworking请求一个网站出现了以下错误 Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7fc688f3

rlwrap安装报错You need the GNU readline 解决方法

首先大家肯定知道rlwrap是干什么的? 在linux以及unix中,sqlplus的上下左右.回退无法使用,会出现乱码情况.而rlwrap这个软件就是用来解决这个的. 这个错误曾经困扰我很久很久!下载readline 安装,安装好readline 还是无法运行rlwrap的安装程序 在网上搜寻很久才找到一个靠谱的解决方法 原来rlwrap这个程序的安装,需要依赖两个包, 一个是readline,这个readline在RHEL中已经集成了.不需要去专门下载 另外一个包 libtermcap-de

ECLIPSE中部署工程报“Undefined exploded archive location”错误的解决方法。

错误信息为:Undefined exploded archive location 原因:在工程转移过程中,导致工程的配置文件出错: 解决方法:           1.在工程目录下的.mymetadata文件中可能webrootdir被改无效了(把下面内容拷到你的.mymetadate文件中的相应位置上):或者有可能少了这context-root这个属性:添加上这个属性即可,内容如下:             context-root="/上面的name属性值"          

Failed dependencies: 检查依赖性错误 解决方法

centOs下: error: Failed dependencies: 检查依赖性错误 解决方法 刚才安装avast的linux版,结果出现了: [[email protected] /]# rpm -ivh avast4workstation-1.3.0-1.i586.rpmerror: Failed dependencies:libexpat.so.1 is needed by avast4workstation-1.3.0-1.i586 error: Failed dependencie

VC6.0 出现failed to (or don&#39;t know how to) build 原因及解决方法

http://blog.sina.com.cn/s/blog_a37606de01016kit.html 在VC++6.0中出现failed to (or don't know how to) build 'D:\DIB类\CDib.cpp该如何解决呢 ? 原因是这个类是在别的工程中建立的,后来通过加入文件加入本工程的,当这个工程被复制到别的目录或者该文件原来在的工程换了位置就无法编译通过过了. 解决办法:找到××.dsp文件(××为工程名),用记事本打开,找到如下: SOURCE="..\DI

Error:Execution failed for task &#39;:app:transformClassesWithDexForDebug&#39;解决方法

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 类似问题我通过审查build.gradle引用的lib,把所有功能重复

Loadrunner报错“Too many local variablesAction.c”解决方法

问题描述,在Action.c里定义数组时如果数组长度过长,如char a[1024*1024]运行时即会报错: 意思为:太多的局部变量 问题原因及解决方法如下: 1. VuGen对于局部变量可以分配的最大内存为64K,如果想分配空间大于64K的变量的话,需要通过如下方法: a. 将其定义为全局变量,Declare it globally. char buffer[100000]; Actions() { return 0; } b. 使用malloc()来分配内存,Use malloc() to