Rabbitmq consumer端超时报错
0x01 应用场景:
使用rabbitmq的exchange模式,type为direct,消费端不需要向生产端返回结果no_ack=True
其中某个consumer任务耗时较长(5min以上),结果consumer端出现如下报错:
Exception in thread test:
Traceback (most recent call last):
File "D:\Program Files (x86)\python\lib\threading.py", line 530, in __bootstrap_inner
self.run()
File "E:/A_WORK/eclipse/ccin/src/main.py", line 282, in run
channel.start_consuming()
File "D:\Program Files (x86)\python\lib\site-packages\pika-0.10.0-py2.7.egg\pika\adapters\blocking_connection.py", line 1681, in start_consuming
self.connection.process_data_events(time_limit=None)
File "D:\Program Files (x86)\python\lib\site-packages\pika-0.10.0-py2.7.egg\pika\adapters\blocking_connection.py", line 647, in process_data_events
self._flush_output(common_terminator)
File "D:\Program Files (x86)\python\lib\site-packages\pika-0.10.0-py2.7.egg\pika\adapters\blocking_connection.py", line 426, in _flush_output
raise exceptions.ConnectionClosed()
ConnectionClosed
网上查了半天,发现有人说是因为consumer耗时太长,导致product和consumer之间的heartbeat断链了,考虑修改配置文件中的heartbeat时间来规避这个问题。
0x02 解决方法一:
修改rabbitmq.config
1 文件路径:
file is %APPDATA%\RabbitMQ\rabbitmq.config.
%APPDATA% usually expands to C:\Users\%USERNAME%\AppData\Roaming or similar.
见rabbit安装文件夹下的readme.txt ~~\rabbitmq_server-3.7.2\etc\README.txt
2 修改 C:\Users\%USERNAME%\AppData\Roaming\RabbitMQ\rabbitmq.config文件(将rabbitmq.config.example重命名为rabbitmq.config)
将 %% {heartbeat, 60}, 修改为 {heartbeat, 600}
去掉%% 和末尾的逗号',' 60秒修改为600秒,或自己定义的更长时间。
3 使配置生效:
cmd进入安装目录的sbin文件夹下
******\rabbitmq_server-3.7.2\sbin>
执行:rabbitmq-service.bat stop 停止服务
rabbitmq-service.bat install 重新安装服务,这时才会重新加载config文件
rabbitmq-service.bat start 开启服务
提示成功以后,再运行程序,发现就不会出现之前的异常了。
0x03 解决方法二:
在建立连接的时候就禁止心跳检测
producer端和consumer端连接初始化的时候:
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost', heartbeat_interval=0))
Rabbitmq consumer端超时报错的更多相关文章
- 【small项目】MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link ...
- redis连接超时报错
应用程序连接redis超时,报错如下: ERROR DubboServerHandler-xxx.xx.xx.52:20880-thread-172 2016-12-21 15:25:20,429 c ...
- sql server数据库查询超时报错
报错信息如下: 链接服务器"DBJointFrame"的 OLE DB 访问接口 "SQLNCLI10" 返回了消息 "查询超时已过期". ...
- vue.js使用vue-preview做移动端缩略图时报错Property or method "$preview" is not defined
报错的详细信息为: Property or method "$preview" is not defined on the instance but referenced duri ...
- wpscan 更新超时报错
wpscan更新超时报错 本人亲测方法2 https://data.wpscan.org/plugins.json https://data.wpscan.org/plugins.json.sha51 ...
- springcloud初次zuul超时报错com.netflix.zuul.exception.ZuulException:Forwarding error
报错如下 com.netflix.zuul.exception.ZuulException:Forwarding error Caused by: com.netflix.hystrix.except ...
- tomcat链接mysql时超时报错java.io.EOFException: Can not read response from server. Expected to read 4 bytes,
需要在配置文件里加上下面就ok了 <property name=”minEvictableIdleTimeMillis” value=”1800000″ /> <property n ...
- Uedior上传大文件超时报错
出错原因: 1.php超时等待时间太短 2.uedior中设置了请求超时,提示信息: 上传失败,请重试 先解决第一个问题: 设置php.ini中的max_execution_time 为0 (意思是h ...
- python Selenium chromedriver 自动化超时报错:你需要使用多标签保护罩护体
在使用selenium + chrome 作自动化测试的时候,有可能会出现网页连接超时的情况 如果出现网页连接超时,将会导致 webdriver 也跟着无法响应,不能继续进行任何操作 即时是去打开新的 ...
随机推荐
- 用 ArcMap 发布 ArcGIS Server Feature Server Feature Access 服务 SQL Server版
1. 安装Desktop, 2. 安装ArcGIS Server 3. 安装SQLServer2017 4. ArcMap 中 Catalog 中注册ArcGIS Server 5. System T ...
- SQLServer 数据库索引碎片
--改成当前库 use DB_Name --创建变量 指定要查看的表 declare @table_id int set @table_id=object_id('TableName') --执行 d ...
- Dubbo-服务注册中心之AbstractRegistry
在dubbo中,关于注册中心Registry的有关实现封装在了dubbo-registry模块中.提供者(Provider)个消费者(Consumer)都是通过注册中心进行资源的调度.当服务启动时,p ...
- TCL常用命令
1.删除文件 file delete A file delete -force A 2.建立文件夹 file mkdir A file mkdir A/A 3.判断文件夹是否存在 file exist ...
- Nginx proxy_set_header 配置注意事项
转载自:https://www.jianshu.com/p/fd16b3d10752 如果没有特别注意 proxy_set_header 配置,使用 proxy_set_header 可能会引起以下问 ...
- ASPxGridView 排序、分页、加载数据必需的三个函数
protected void ASPxGridViewPoint_OnCustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs ...
- Laravel通过用户名和密码查询
一.如果要检查要验证的用户数据是否正确,可以使用: if (Auth::validate($credentials)) { // } 二.但是如果您想通过用户和密码从数据库中获取用户,您可以使用: / ...
- nvm —— Node版本管理工具
nvm下载 下载地址 下载nvm-setup.zip文件 nvm安装 1.以管理员身份运行install.cmd文件,设置文件路径 root: C:\Users\Administrator\AppDa ...
- Alan Walker MV 合辑01 by defender
Alan Walker MV合辑 出来啦! 百度网盘下载地址: 链接:https://pan.baidu.com/s/10WSool70XBe_8tJOae8V-w 提取码:uckq 地址查看 Mi ...
- 将本地文件git到远程github仓库
使用git管理项目是开发人员必备的技能,下面就介绍如何使用git将本地文件管理并且同步到github上面. 小白可以参考 创建SSH-key并且在github中添加认证 在本地用户的.ssh文件下面生 ...