【问题标题】:RabbitMq connection reset by peer对等方重置 RabbitMq 连接
【发布时间】:2016-05-09 08:28:04
【问题描述】:

我在使用 RabbitMQ 时遇到污点错误。我发送了一些关于产品抛出 RabbitMq 和 Php 的信息,但是出了点问题。我可以在一分钟后发送消息,我有异常 "errno=104 Connection reset by peer" 。见下文:

2016-05-09 08:13:14 Daemon start
2016-05-09 08:13:17 Send to shop-id-1-price
2016-05-09 08:13:21 Send to shop-id-1-price
2016-05-09 08:13:24 Send to shop-id-1-price
2016-05-09 08:13:28 Send to shop-id-1-price
2016-05-09 08:13:32 Send to shop-id-1-price
2016-05-09 08:13:36 Send to shop-id-1-price
2016-05-09 08:13:39 Send to shop-id-1-price
2016-05-09 08:13:43 Send to shop-id-1-price
2016-05-09 08:13:47 Send to shop-id-1-price


  [ErrorException]                                                           
  fwrite(): send of 21 bytes failed with errno=104 Connection reset by peer  


rabbitmq:consumer [-m|--messages [MESSAGES]] [-r|--route [ROUTE]] [-l|--memory-limi
t [MEMORY-LIMIT]] [-d|--debug] [--] <name>

PHP Fatal error:  Uncaught ErrorException: fwrite(): send of 19 bytes failed with e
rrno=32 Broken pipe in /chroot/data/stage/home/html/vendor/videlalva
ro/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php:271

rabbitmq 版本 - 3.6.1,php 版本 - 7.0.5,php-amqp 库版本 - "videlalvaro/php-amqplib" : "~2.7

来自 rabbitmq 的日志:

=INFO REPORT==== 9-May-2016::03:36:53 ===
accepting AMQP connection <0.25777.24> (104.207.249.104:38001 -> 104.207.249.104:5672)

=ERROR REPORT==== 9-May-2016::03:37:23 ===
closing AMQP connection <0.25777.24> (104.207.249.104:38001 -> 104.207.249.104:5672):
{writer,send_failed,{error,timeout}}

【问题讨论】:

  • 你能发布/分享rabbitmq日志吗?
  • 添加 rabbitmq 日志。我注意到,当在队列中有许多消息时,会发生此错误。如果队列为空或队列中只有一些消息 idaemon 工作正常
  • 有几个帖子出现这个错误,例如:stackoverflow.com/questions/35438843/rabbitmq-error-timeout
  • 非常感谢,对我有帮助!

标签: php rabbitmq php-amqplib


【解决方案1】:

@Gabriele 的链接对我有帮助,以下是问题的详细信息:https://stackoverflow.com/a/36114095/1476819

这两个变化解决了我的问题:

  • 在调用 basic_consume 之前添加此内容。它将 prefetch_count 设置为 1 而不是“无穷大”。
$channel->basic_qos(null, 1, null);
$channel->basic_consume(...);

我同时做了这些改动,现在可以和docker一起使用了。

【讨论】:

    猜你喜欢
    • 2022-12-28
    • 2013-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多