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 也跟着无法响应,不能继续进行任何操作 即时是去打开新的 ...
随机推荐
- ASP.NET常用内置对象(二)Response
response翻译为中文:响应. 将数据作为请求的结果从服务器发送到客户浏览器中,并提供有关响应的消息.它可用来在页面中输出数据,在页面中跳转,还可以传递各个页面的参数. Response对象是Sy ...
- BDA3 Chapter 1 Probability and inference
1. uncertainty aleatoric uncertainty 偶然不确定性 epistemic uncertainty 认知不确定性 2. probability VS likelihoo ...
- Tickets HDU - 1260 简单dp
#include<iostream> using namespace std; const int N=1e5; int T,n; int a[N],b[N]; int dp[N]; in ...
- Android Studio阶段性学习总结_1
这半个月一直在学习Android方面的知识,对Android开发有了一个基本的认识,学会了Android studio的基本操作. 在建立第一个Android studio项目时,我遇到了很大的阻碍, ...
- [P3935] Calculating - 整除分块
容易发现题目要求的 \(f(x)\) 就是 \(x\) 的不同因子个数 现在考虑如何求 \(\sum_{i=1}^n f(i)\),可以考虑去算每个数作为因子出现了多少次,很容易发现是 \([n/i] ...
- 安装python3.7.4时报错:Service Pack 1 is required to continue installation
python3.7.4安装失败:Service Pack 1 is required to continue installation 解决办法: 点击报错页面中的“log file”,日志最后一行显 ...
- 基于Web的网络商城项目设计与实现【SSM+Bootstrap+Vue】
[Spring+SpringMVC+MyBatis+Bootstrap+Vue] 演示:线路1 线路2 1.系统功能介绍 网上商城系统 是一个功能完善的在线购物系统 - ,主要为在线销售和在线购物服 ...
- 题解 CF409A 【The Great Game】
题目传送门. 思路: 首先我们定义\(2\)个字符串,分别存放 TEAM 1 与 TEAM 2 的出招顺序.接着再定义\(2\)个变量,存放 TEAM 1 与 TEAM 2 的分数. string s ...
- idea修改忽视文件产生得bug
为了提交代码方便,在idea中增加了忽视文件选项. 这一修改可把自己坑惨了,更改代码运行代码得时候,连打印都没出来,对照了半天代码 也没发现是哪里得错误,后来想到某次修改代码后class文件并没改变, ...
- 白面系列 mongoDB
mongoDB和redis一样,都是noSQL技术之一. redis是Key-Value存储,mongoDB是文档存储. 文档存储一般用类似json的格式存储,存储的内容是文档型的.文档是一组键值(k ...