Try to reopen Redis pubsub connection after connection drops
Closed this issue ยท 3 comments
Currently when my system ends up restarting the Redis, then LuckPerms won't attempt to restart the pubsub connection, ending up with network going out of sync.
[23:08:41 WARN]: me.lucko.luckperms.lib.jedis.exceptions.JedisConnectionException: Unexpected end of stream.
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.util.RedisInputStream.ensureFill(RedisInputStream.java:202)
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.util.RedisInputStream.readByte(RedisInputStream.java:43)
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.Protocol.process(Protocol.java:155)
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.Protocol.read(Protocol.java:220)
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:278)
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.Connection.getUnflushedObjectMultiBulkReply(Connection.java:240)
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.JedisPubSub.process(JedisPubSub.java:123)
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.JedisPubSub.proceed(JedisPubSub.java:117)
[23:08:41 WARN]: at me.lucko.luckperms.lib.jedis.Jedis.subscribe(Jedis.java:2816)
[23:08:41 WARN]: at me.lucko.luckperms.common.messaging.redis.RedisMessenger.lambda$init$0(RedisMessenger.java:69)
[23:08:41 WARN]: at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1429)
[23:08:41 WARN]: at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[23:08:41 WARN]: at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
[23:08:41 WARN]: at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
[23:08:41 WARN]: at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
[23:08:41 WARN]: at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
In ideal, pub sub connection should be restarted (with backoff delay perhaps?).
I don't think the Jedis driver has native support for this - will happily accept a PR if you can add it.
Only class you need to care about is RedisMessenger
: https://github.com/lucko/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/messaging/redis/RedisMessenger.java
Maybe the approach from https://github.com/minecrafter/RedisBungee/blob/master/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java#L502 is a solution