in use jedis connect redis And call publish Method to publish a message , There it is ArrayIndexOutOfBoundsException abnormal , What was used at that time was jedis2.1.0 edition , Look at the source code and find that it is write Method by increasing the count, Occurs when writing data to a cache byte array ArrayIndexOutOfBoundsException, And the anomaly is sporadic , Not necessarily , So the reason is not easy to trace .
I've seen it in other modules before jedis connect redis All kinds of problems appeared in , For example, there are the following exceptions :
org.jivesoftware.openfire.RedisConnection - Subscribing failed with exception:
redis.clients.jedis.exceptions.JedisConnectionException:
java.net.SocketException: Broken pipe         at
redis.clients.jedis.Connection.flush(Connection.java:66)         at
redis.clients.jedis.JedisPubSub.proceed(JedisPubSub.java:82)         at
redis.clients.jedis.Jedis.subscribe(Jedis.java:1971)         at
org.jivesoftware.openfire.RedisConnection$1.run(RedisConnection.java:116)      
  at java.lang.Thread.run(Thread.java:745) Caused by: java.net.SocketException:
Broken pipe         at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:159)      
  at redis.clients.util.RedisOutputStream.flushBuffer(RedisOutputStream.java:29)
        at
redis.clients.util.RedisOutputStream.flush(RedisOutputStream.java:227)        
at redis.clients.jedis.Connection.flush(Connection.java:64)         ... 4 more
Later, the solution was to replace it with a new version jedis Of jar package ——jedis2.5.1, What needs to be reminded is , This version uses commons-pool2 Yes commons-pool2-2.2.jar, need Java
6.0+. If it is used in the project at the same time commons
DBCP, Then you need to pay attention , If you use commons-dbcp-1.4, That still needs to be preserved commons-pool1.x(Java
6.0+), Otherwise, it is necessary to commons-dbcp Upgrade to 2.x edition , and commons-dbcp2-2.0.1 need Java 7.0+.
Process replacement jar, In release redis Some changes have also been made in connection , The connection and release will be retried several times .

Technology
©2019-2020 Toolsou All rights reserved,
QT Delete directory and file Java aggregate ------LinkedHashMap Underlying principle I've been drinking soft water for three years ? What is the use of soft water and water softener Java Xiao Ming A+B About wechat payment body( Product description ) Problems encountered Digital rolling lottery program 3 species Python data structure ,13 Creation methods , This is the conclusion , Great ! Huawei Mate 40 Pro+ 5G exposure : Leica film lens , Ceramic body What's the difference in server prices ? Operators Website visitors' mobile phone number capture