Aelysium-Group / rusty-connector

A player and server connection manager for Velocity based Minecraft Networks!
GNU General Public License v3.0
77 stars 17 forks source link

If another plugin moves a player while Rusty Connector is trying to it triggers an error. #17

Closed TheDeafCreeper closed 1 year ago

TheDeafCreeper commented 1 year ago

Redis still being bad it seems.

Error on Proxy:

[02:41:38 ERROR] [rustyconnector-velocity]: There was an issue handling the message. Throwing away...
java.lang.Exception: There was an issue connecting you to the server!
        at group.aelysium.rustyconnector.plugin.velocity.lib.message.handling.SendPlayerHandler.execute(SendPlayerHandler.java:37) ~[?:?]
        at group.aelysium.rustyconnector.plugin.velocity.lib.database.RedisSubscriber.processParameters(RedisSubscriber.java:85) ~[?:?]
        at group.aelysium.rustyconnector.plugin.velocity.lib.database.RedisSubscriber.onMessage(RedisSubscriber.java:49) ~[?:?]
        at group.aelysium.rustyconnector.core.lib.database.redis.RedisSubscriber$RedisMessageListener.message(RedisSubscriber.java:69) ~[?:?]
        at group.aelysium.rustyconnector.core.lib.database.redis.RedisSubscriber$RedisMessageListener.message(RedisSubscriber.java:66) ~[?:?]
        at io.lettuce.core.pubsub.PubSubEndpoint.notifyListeners(PubSubEndpoint.java:219) ~[?:?]
        at io.lettuce.core.pubsub.PubSubEndpoint.notifyMessage(PubSubEndpoint.java:208) ~[?:?]
        at io.lettuce.core.pubsub.PubSubCommandHandler.doNotifyMessage(PubSubCommandHandler.java:292) ~[?:?]
        at io.lettuce.core.pubsub.PubSubCommandHandler.notifyPushListeners(PubSubCommandHandler.java:223) ~[?:?]
        at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:647) ~[?:?]
        at io.lettuce.core.pubsub.PubSubCommandHandler.decode(PubSubCommandHandler.java:112) ~[?:?]
        at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:599) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:499) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:397) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[proxy.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
        at java.lang.Thread.run(Thread.java:833) [?:?]

Code I'm using to send players is:

for (player in onlinePlayers) {
    Bukkit.dispatchCommand(Bukkit.getServer().consoleSender, "rustyconnector-paper:rc send ${player.name} woolsacre-lobby")
}
TheDeafCreeper commented 1 year ago

Did 3 games with 4 players, and had 2, 1, and 3 players get kicked after they were sent to the lobby family.

TheDeafCreeper commented 1 year ago

(Also the messages don't appear to be showing up in /rc message list)

nathan-i-martin commented 1 year ago

what does your /rc message list look like? are you looking at the right page? You can switch pages using /rc message list <page number>

nathan-i-martin commented 1 year ago

oof yeah plz use pastebin for this lmao. Check your exception again, just under it, it should say something like To view the thrown away message use: /rc message get <some long number>

Also the reason why the PING messages aren't cached is probably because your save-trashed-messages setting in logger.yml is set to false

nathan-i-martin commented 1 year ago

But tbh if the message hasn't appeared on one of those pages, it's probably been pushed out of the cache by now by all the PONG messages.

I'd probably say to try and reproduce the error and then immediately get that message so we can take a look.

TheDeafCreeper commented 1 year ago

Just going to delete that wall of text. Managed to catch the message though and it's not very helpful.

Status: EXECUTING_ERROR
Reason: There was an issue connecting you to the server!

ID: 1121281686382854144
Timestamp: Thu Jun 22 03:33:06 UTC 2023
Contents: {"k":"[KEY]","v":1,"t":"SEND","o":"SERVER","a":"ns1006130.ip-135-148-52.us:41227","p":{"f":"woolsacre-lobby","p":"726b6a4a-e654-47bb-9764-d067ee3c056b"}}
TheDeafCreeper commented 1 year ago

This error appeared as well

[03:33:06 ERROR]: java.lang.NullPointerException: Cannot invoke "group.aelysium.rustyconnector.plugin.velocity.lib.module.PlayerServer.playerLeft()" because "server" is null
> 
[03:33:06 ERROR]:       at group.aelysium.rustyconnector.plugin.velocity.lib.events.OnPlayerDisconnect.lambda$onPlayerDisconnect$0(OnPlayerDisconnect.java:32)
> 
[03:33:06 ERROR]:       at com.velocitypowered.api.event.EventTask$1.execute(EventTask.java:66)
> 
[03:33:06 ERROR]:       at com.velocitypowered.proxy.event.VelocityEventManager$ContinuationTask.execute(VelocityEventManager.java:545)
> 
[03:33:06 ERROR]:       at com.velocitypowered.proxy.event.VelocityEventManager.fire(VelocityEventManager.java:604)
> 
[03:33:06 ERROR]:       at com.velocitypowered.proxy.event.VelocityEventManager.lambda$fire$5(VelocityEventManager.java:478)
> 
[03:33:06 ERROR]:       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
> 
[03:33:06 ERROR]:       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
> 
[03:33:06 ERROR]:       at java.base/java.lang.Thread.run(Thread.java:833)

That was after the "There was an issue connecting you to the server!" error so it could just be caused by the player getting kicked.

TheDeafCreeper commented 1 year ago

Actually, I wonder if it's caused by Party and Friends at all, let me test a bit more.

TheDeafCreeper commented 1 year ago

Ok, It does seem to be some sort of conflict between Party and Friends and Rusty Connector, since when not in a party no one seems to get kicked, and I (the party leader) never got kicked.

My guess is that the send is started at the same time for all players, then when I (the party leader) get moved, Party and Friends moves everyone else. Then, any players that ended up being sent after me get kicked since they're no longer in the server Rusty Connector expects them to be in and panics.

(Also Persistence is off in woolsacre-lobby)

TheDeafCreeper commented 1 year ago

Based on what I can tell it seems that line 198/199 in ScalarServerFamily is the actual error being triggered. Could it be because the player gets sent to the other server before Rusty Connector get's to it, then since it's trying send the player to the family it's already in it fails, kicking the player because of how the send was triggered?

nathan-i-martin commented 1 year ago

Yeah so as you said it def seems like that other plug-in is causing some sort of issue. Technically speaking, it doesn't actually matter if the player is in the family that they are trying to connect to (so I'm in lobby and then I attempt to send myself to lobby again)

What I think may be causing this is that the party's plugin is making a connection request to Velocity almost at the exact same time that RC is making that same request. So I wonder if Velocity itself just shits the bed.

In the morning I'm gonna read through all this again and see if there are any improvements I can make that might be able to solve this issue. If not, I'll focus more on getting the party's system for v0.6.0 done faster so that using this conflicting plugin won't be necessary.

Because of how much RC deals with connections and the servers and such, anything that inserts it's own connection behavior is basically fair game lmao That's why RC specifically disables the default /server command that comes with Velocity. The plug-in has specific orders of operations which are pretty important for different things

nathan-i-martin commented 1 year ago

As RC doesn't play nice with any other plugins attempting to inject their own connection stuff. This has been "patched" by adding our own version of a Friends/Party system. This feature was already in the plans/works but this issue accelerated the desire to develop it.