JedisConnectionException Connection Reset
使用Jedis的subscribe进行消息订阅时有时会抛出JedisConnectionException:Connection Reset
,查看redis-server控制台,发现有如下信息输出:
subscribe scheduled to be closed ASAP for outcoming of output buffer limits
从字面意思来看是消息输出的缓冲区已经超出了限制,所以订阅的链接被关闭了。这通常是由于消息的生产者生产的消息的速度快于消费的速度,导致消息积压,从而超出了Redis的限制。这是redis的一种自我保护机制,遇到这种情况下它就会关闭对应的连接。解决方式就是调整对应的缓冲区大小。关于缓冲区的说明在redis的配置文件redis.conf中有说明。以下是摘自其配置文件的说明。
# The client output buffer limits can be used to force disconnection of clients
# that are not reading data from the server fast enough for some reason (a
# common reason is that a Pub/Sub client can't consume messages as fast as the
# publisher can produce them).
#
# The limit can be set differently for the three different classes of clients:
#
# normal -> normal clients including MONITOR clients
# slave -> slave clients
# pubsub -> clients subscribed to at least one pubsub channel or pattern
#
# The syntax of every client-output-buffer-limit directive is the following:
#
# client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
#
# A client is immediately disconnected once the hard limit is reached, or if
# the soft limit is reached and remains reached for the specified number of
# seconds (continuously).
# So for instance if the hard limit is 32 megabytes and the soft limit is
# 16 megabytes / 10 seconds, the client will get disconnected immediately
# if the size of the output buffers reach 32 megabytes, but will also get
# disconnected if the client reaches 16 megabytes and continuously overcomes
# the limit for 10 seconds.
#
# By default normal clients are not limited because they don't receive data
# without asking (in a push way), but just after a request, so only
# asynchronous clients may create a scenario where data is requested faster
# than it can read.
#
# Instead there is a default limit for pubsub and slave clients, since
# subscribers and slaves receive data in a push fashion.
#
# Both the hard or the soft limit can be disabled by setting them to zero.
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
笔者遇到的是由于发布/订阅的消息超出了缓冲区的大小导致的,所以需要调整client-output-buffer-limit pubsub 32mb 8mb 60
。适当的调大对应的缓冲区大小即可。
相关推荐
connection reset解决方案(亲测可用).md
linux iptables防火墙黑名单(封IP) Connection reset by peer
linux设置connection was reset
解决oracle数据库发生'Connection reset by peer' or 'Connection reset'的错误 这边的数据库连接是kettle自带的h2数据库,只要有kettle就有这个数据库,目录位于data-integration\samples\db\,连接方式是 ...
Java中的`java.net.SocketException: Connection reset`是一个常见的网络编程错误,通常表示在TCP/IP通信过程中,连接突然中断。这个异常可能在客户端或服务器端发生,通常与数据传输的异常中断有关。 首先,我们来...
在Java编程中,"connection reset"异常通常表示网络连接在数据传输过程中突然中断,这可能是由多种原因导致的。在本文中,我们将深入探讨这种异常的处理和分析,特别是与Java中的Socket通信相关的方面。 首先,`...
"Connection Reset by Peer" 是一个常见的网络错误,通常在数据传输过程中出现,表明通信的另一方(客户端或服务器)突然终止了连接。这个问题可能由多种原因引起,下面我们将详细探讨这些原因并提供相应的解决方案...
错误 101 (net--ERR_CONNECTION_RESET).docx
然而,在处理网络连接时,有时会遇到错误提示"CURL ERROR: Recv failure: Connection reset by peer"。这个错误通常意味着在数据传输过程中,服务器或客户端意外地断开了连接,导致通信失败。以下是针对该问题的详细...
read tcp 192.168.31.60:55550->104.18.123.25:443: read: connection reset by peer 传输异常 然后看见网上说可以配置阿里云提供的镜像加速 具体方式 进入阿里云的容器镜像服务 快速链接: 容器镜像服务 复制加速...
在使用PyCharm进行GitHub操作时,有时可能会遇到“connection reset”错误,这通常是由于GitHub的安全策略更新或者网络连接问题导致的。PyCharm是一款强大的Python集成开发环境,它集成了版本控制工具,包括对GitHub...
NULL 博文链接:https://jian1120java.iteye.com/blog/1974813
ERR_CONNECTION_RESET的解释是:ERR-错误CONNECTION-连接-RESET-重复 Google没有对此错误的解决方案因此会再次提示用户这个网站含有未知错误
关于用jmeter做性能测试时的测试报告导出方法和connection reset报错信息的分析以及解决方案。
根据给定的文件信息,我们可以总结出以下关于SQL数据库连接(Connection)的相关知识点: ### SQL数据库连接(Connection)概述 在Java中,`Connection`对象是JDBC API的核心组件之一,用于与数据库建立连接。它是...