minecrafter / RedisBungee

The leading player synchronization system for BungeeCord
https://www.spigotmc.org/resources/redisbungee.13494/
Eclipse Public License 1.0
159 stars 123 forks source link

fix automatic pubsub reconnect in case of network issues #36

Closed Moehritz closed 8 years ago

Moehritz commented 8 years ago

Happened to us during a network separation, resulting in not longer listeing to network events

redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Broken pipe
    at redis.clients.jedis.Connection.flush(Connection.java:291)
    at redis.clients.jedis.JedisPubSub.unsubscribe(JedisPubSub.java:44)
    at com.imaginarycode.minecraft.redisbungee.RedisBungee$PubSubListener.run(RedisBungee.java:526)
    at net.md_5.bungee.scheduler.BungeeTask.run(BungeeTask.java:63)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    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:109)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    at redis.clients.util.RedisOutputStream.flushBuffer(RedisOutputStream.java:31)
    at redis.clients.util.RedisOutputStream.flush(RedisOutputStream.java:213)
    at redis.clients.jedis.Connection.flush(Connection.java:288)
    ... 6 more
minecrafter commented 8 years ago

Pretty much the entirety of the PubSub code needs to be rewritten. It's just ugly.

Moehritz commented 8 years ago

To be exact, the .unsubscribe() isn´t even required, as the connection is already broken at this point.

But for now, we´re going to stick with this fix (not stopping you from rewriting everything, of course!)