"Jedis NOAUTH Authentication required"-Java 16 升级后的垃圾邮件
"Jedis NOAUTH Authentication required"-spam after Java 16 upgrade
最近,由于客户要求,我们将所有系统迁移到 java16。所以这是一个不变的决定。
升级后我们的 jedis 连接开始向终端发送垃圾邮件,错误代码为:
[17:17:31 ERROR]: [redis.clients.jedis.JedisFactory] Error while validating pooled Jedis object.
redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.
at redis.clients.jedis.Protocol.processError(Protocol.java:135) ~[?:?]
at redis.clients.jedis.Protocol.process(Protocol.java:169) ~[?:?]
at redis.clients.jedis.Protocol.read(Protocol.java:223) ~[?:?]
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:352) ~[?:?]
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:270) ~[?:?]
at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:379) ~[?:?]
at redis.clients.jedis.JedisFactory.validateObject(JedisFactory.java:214) ~[?:?]
at org.apache.commons.pool2.impl.GenericObjectPool.evict(GenericObjectPool.java:810) ~[?:?]
at org.apache.commons.pool2.impl.BaseGenericObjectPool$Evictor.run(BaseGenericObjectPool.java:1160) ~[?:?]
at org.apache.commons.pool2.impl.EvictionTimer$WeakRunner.run(EvictionTimer.java:213) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[?:?]
at java.lang.Thread.run(Thread.java:831) [?:?]
系统信息:
Debian 终结者 (10)
Java版本:16.0.1
Jedis 版本:4.0.0-SNAPSHOT(也尝试使用 3.6.x 和 3.5.x)
远程服务器redis版本:5.0.3
公共池:2.9.0(也试过 2.5.0)
连接代码:
Jedis jedis = null;
try {
jedisPool = new JedisPool("XXX.XXX.XXX.XXX", XXX, 10000);
jedis = MasterMind.getInstance().getJedisPool().getResource();
jedis.auth("<SuperSafePass>");
jedis.exists("test");
Bukkit.getLogger().info("Connection build");
} catch (Exception e) {
e.printStackTrace();
Bukkit.getLogger().warning("Connection failure");
} finally {
if (jedis != null)
jedis.close();
}
如您所见,我验证正确。建立连接。大约 30 秒后,它开始向错误发送垃圾邮件(每 30 秒大约 10 次)
如果 Redis 需要密码,则必须在创建 JedisPool
时设置密码,使用
等构造函数之一
public JedisPool(final GenericObjectPoolConfig poolConfig, final String host, int port,
int timeout, final String password) { ... }
使用
手动验证
jedis.auth(...);
在这种情况下不再需要。
最近,由于客户要求,我们将所有系统迁移到 java16。所以这是一个不变的决定。
升级后我们的 jedis 连接开始向终端发送垃圾邮件,错误代码为:
[17:17:31 ERROR]: [redis.clients.jedis.JedisFactory] Error while validating pooled Jedis object.
redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.
at redis.clients.jedis.Protocol.processError(Protocol.java:135) ~[?:?]
at redis.clients.jedis.Protocol.process(Protocol.java:169) ~[?:?]
at redis.clients.jedis.Protocol.read(Protocol.java:223) ~[?:?]
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:352) ~[?:?]
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:270) ~[?:?]
at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:379) ~[?:?]
at redis.clients.jedis.JedisFactory.validateObject(JedisFactory.java:214) ~[?:?]
at org.apache.commons.pool2.impl.GenericObjectPool.evict(GenericObjectPool.java:810) ~[?:?]
at org.apache.commons.pool2.impl.BaseGenericObjectPool$Evictor.run(BaseGenericObjectPool.java:1160) ~[?:?]
at org.apache.commons.pool2.impl.EvictionTimer$WeakRunner.run(EvictionTimer.java:213) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[?:?]
at java.lang.Thread.run(Thread.java:831) [?:?]
系统信息:
Debian 终结者 (10) Java版本:16.0.1 Jedis 版本:4.0.0-SNAPSHOT(也尝试使用 3.6.x 和 3.5.x) 远程服务器redis版本:5.0.3 公共池:2.9.0(也试过 2.5.0)
连接代码:
Jedis jedis = null;
try {
jedisPool = new JedisPool("XXX.XXX.XXX.XXX", XXX, 10000);
jedis = MasterMind.getInstance().getJedisPool().getResource();
jedis.auth("<SuperSafePass>");
jedis.exists("test");
Bukkit.getLogger().info("Connection build");
} catch (Exception e) {
e.printStackTrace();
Bukkit.getLogger().warning("Connection failure");
} finally {
if (jedis != null)
jedis.close();
}
如您所见,我验证正确。建立连接。大约 30 秒后,它开始向错误发送垃圾邮件(每 30 秒大约 10 次)
如果 Redis 需要密码,则必须在创建 JedisPool
时设置密码,使用
public JedisPool(final GenericObjectPoolConfig poolConfig, final String host, int port,
int timeout, final String password) { ... }
使用
手动验证jedis.auth(...);
在这种情况下不再需要。