Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't register custom payload: Too many channels registered #488

Closed
LemADEC opened this issue May 31, 2017 · 38 comments
Closed

Couldn't register custom payload: Too many channels registered #488

LemADEC opened this issue May 31, 2017 · 38 comments

Comments

@LemADEC
Copy link

LemADEC commented May 31, 2017

As of build 54, a client with 1.10.2 running FTB Beyond 1.8.0 can't connect to a spigot 1.11.2 r1251 server:

[20:19:40 INFO]: LemADEC[/x.x.x.x:48247] logged in with entity id 3 at ([hub]-1090.5, 35.0, 519.5)
[20:19:41 ERROR]: Couldn't register custom payload
java.lang.IllegalStateException: Too many channels registered
>       at com.google.common.base.Preconditions.checkState(Preconditions.java:176) ~[spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer.addChannel(CraftPlayer.java:1099) ~[spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:2505) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.PacketPlayInCustomPayload.a(SourceFile:58) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.PacketPlayInCustomPayload.a(SourceFile:8) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_121]
>       at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_121]
>       at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:747) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
[20:19:41 INFO]: LemADEC lost connection: Invalid payload REGISTER!

Issue seems related to an accumulation or interaction of multiple mods, and not a specific mod by itself.
Issue is reproduced with no other plugins installed.

@Shevchik
Copy link
Member

Not a ProtocolSupport problem.

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

I don't the issue without Protocol Support. Any idea what would be causing it then?

@Shevchik
Copy link
Member

java.lang.IllegalStateException: Too many channels registered

Too many custom payload channels registered by mods.

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

So it's a regression from Spigot or Vanilla on 1.11.x? there's no configuration we could change to workaround that?

@gdude2002
Copy link
Contributor

There isn't really a workaround, it's a hardcoded limit in the client and server

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

From what I get, that limit is there for a long time: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/browse/CraftBukkit-Patches/0070-Cap-Channel-Registrations.patch#14
Does this mean ProtocolSupport requires its own additional channels then? How many are we talking?

@gdude2002
Copy link
Contributor

I'm not sure exactly, but it does a lot of work with Netty under the hood, possibly including a few extra channels.

What else are you using? It's pretty hard to hit that limit.

@Shevchik
Copy link
Member

Shevchik commented May 31, 2017

ProtocolSupport doesn't register custom payload channels itself.

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

There's no plugins other than ProtocolSupport and latest Spigot on that server.
I do have a Bungee (HexaCord) proxy behind.

@gdude2002
Copy link
Contributor

Does it happen if you connect without bungee?

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

Same with direct connection:

[06:26:46 ERROR]: Couldn't register custom payload
java.lang.IllegalStateException: Too many channels registered
>       at com.google.common.base.Preconditions.checkState(Preconditions.java:176) ~[spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer.addChannel(CraftPlayer.java:1099) ~[spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:2505) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.PacketPlayInCustomPayload.a(SourceFile:58) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.PacketPlayInCustomPayload.a(SourceFile:8) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_121]
>       at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_121]
>       at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:747) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot-1.11.2-2017-05-30build1251.jar:git-Spigot-3fb9445-6e3cec8]
>       at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
[06:26:46 INFO]: LemADEC lost connection: Invalid payload REGISTER!

I'm trying to patch spigot, but their build tool is forcing the official sources, I'm missing something

@gdude2002
Copy link
Contributor

This is very strange to be honest.

Can you verify that you're using the latest (stable) versions of HexaCord and Spigot, and the latest version of ProtocolSupport from Jenkins?

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

FTB Beyond was updated yesterday.
Spigot, HexaCord and ProtocolSupport were all updated yesterday from 1.10 to 1.11.

@gdude2002
Copy link
Contributor

Wait, what? You're trying to use ProtocolSupport with a modpack?

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

FTB Beyond is a forge modpack, yes. But the server itself is vanilla. It's just a hub.

@gdude2002
Copy link
Contributor

Does it work if you connect to the hub with a vanilla client?

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

It works with :

  • a vanilla 1.10.2 client
  • a custom 1.11.2 modpack client
  • a public 1.10.2 modpack client (FTB SkyFactory)

@gdude2002
Copy link
Contributor

Wouldn't that suggest that FTB Beyond is the problem?

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

FTB Beyond worked fine for 3+ month on a vanilla 1.10.2 hub server.
There's an interaction with ProtocolSupport that is causing the issue, that's my understanding.

@gdude2002
Copy link
Contributor

Right, but you just said it updated, and it's the only client setup you've tested that can reproduce the problem.

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

I've tried removing mods but couldn't narrow it down, it's a form of accumulation. Yet, while being large, that modpack isn't that big for 1.10+.
I would need a debug log on which mod is registering what custom packet to find who's consuming them like crazy.
On the other end, 128 seems like a fairly low limit for modded servers. I'm surprised the issue isn't more frequent.

@gdude2002
Copy link
Contributor

128 seems like a fairly low limit for modded servers. I'm surprised the issue isn't more frequent.

Well, to be specific, that limit is enforced by Spigot, which is not designed to use mods.

I've tried removing mods but couldn't narrow it down, it's a form of accumulation. Yet, while being large, that modpack isn't that big for 1.10+.
I would need a debug log on which mod is registering what custom packet to find who's consuming them like crazy.

It's very difficult to say, yeah. The main thing is that I don't think there's much we can do about it - The enforcement is upstream, but you're making use of a hub server that is not designed for mods.

An alternative solution that I used on my old network is a Bungee plugin that can place users on specific servers based on their Minecraft version and whether they're running Forge or not. That said, you'd be skipping the hub server in that case, so it may not be ideal for you.

The limit is an upstream problem but ProtocolSupport doesn't create or make use of plugin channels on its own. It's a pretty confusing situation.

@LemADEC
Copy link
Author

LemADEC commented May 31, 2017

It turns out the issue was already there on 1.10 but the exception doesn't kick players and wasn't visible in console.
I've patch around it so it's working fine now, thanks for the help!

@leo60228
Copy link

leo60228 commented Jun 9, 2017

@LemADEC How did you do this? I have the same issue.

@trebiluk
Copy link

@LemADEC Please, share your solution.

@Bolly12321
Copy link

@LemADEC Also would be interested in the solution if you are willing to share.

@gdude2002
Copy link
Contributor

We don't allow the sharing of JARs, but it would be acceptable for @LemADEC to post a patch file.

Sadly this may be a more complicated problem, and they don't seem too keen on sharing...

@azhangvo
Copy link

azhangvo commented Jul 4, 2017

I found the patch he was talking about. I did the patch myself and it works great. Inside the Spigot.jar, you can go into the org/bukkit/craftbukkit/v[some numbers]/entity and inside there, you will find a file called CraftPlayer.class. I would suggest using WinRar to get to this point and then extract it to another folder or easily accessible place. Then, you can do it manually or take my file. My file has a max channel limit of 640 which I think is more than enough. I hope I am allowed to put .class files here :D If you take that and replace the CraftPlayer.class inside the jar with mine and rerun, you should be okay now. If you require more than 640, go get Dirty Joe from here: http://dirty-joe.com/ and open the .class file with it. (Run the exe in the zipped folder and do file open) If you head over to methods and look for a method called addChannel, it's moderately annoying to find in the scroll down menu. DO NOT CHANGE THE NAME! That is the variable name not the one you are selecting. Just hit 'a' until it pops up. Double click the code editor and edit the variable called sipush by double clicking on it and editing the values that pop up. The first 2 I am pretty sure are identifiers so don't touch those. You can mess around with the other numbers until you get something you are satisfied with. Click enter, close out of the code editor, save the file, and put it back into the jar. You can now rerun and you are done! You are welcome to share this tutorial, just please give credit where credit is due. (Unless I am not the first one to do this :/ )
CraftPlayer.zip
^
CraftPlayer file with 640 channel limit.

@Scarsz
Copy link

Scarsz commented Jan 5, 2018

@FatExplodingPig's class file was for 1.11 and I had to do it myself for 1.12.2.

1.12.2-R0.1 CraftPlayer.class with 640 channel limit: CraftPlayer-1.12.2.zip

@JustZerooo
Copy link

JustZerooo commented Mar 31, 2018

[08:07:19 WARN]: Failed to handle packet for /xx.xx.xx.xx:40297
net.minecraft.server.v1_12_R1.ReportedException: Loading entity NBT
        at net.minecraft.server.v1_12_R1.Entity.f(Entity.java:1756) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.WorldNBTStorage.load(WorldNBTStorage.java:206) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.PlayerList.a(PlayerList.java:338) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.PlayerList.a(PlayerList.java:105) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at protocolsupport.zplatform.impl.spigot.network.handler.SpigotLoginListenerPlay.joinGame(SpigotLoginListenerPlay.java:124) ~[?:?]
        at protocolsupport.protocol.packet.handler.AbstractLoginListenerPlay.tryJoin(AbstractLoginListenerPlay.java:131) ~[?:?]
        at protocolsupport.protocol.packet.handler.AbstractLoginListenerPlay.tick(AbstractLoginListenerPlay.java:93) ~[?:?]
        at protocolsupport.zplatform.impl.spigot.network.handler.SpigotLoginListenerPlay.e(SpigotLoginListenerPlay.java:70) ~[?:?]
        at net.minecraft.server.v1_12_R1.NetworkManager.a(NetworkManager.java:255) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.ServerConnection.c(ServerConnection.java:150) [PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:941) [PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:426) [PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:767) [PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:665) [PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
Caused by: java.lang.NullPointerException
        at org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer.sendHealthUpdate(CraftPlayer.java:1403) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer.updateScaledHealth(CraftPlayer.java:1396) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.EntityLiving.setHealth(EntityLiving.java:825) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.EntityLiving.a(EntityLiving.java:530) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.EntityHuman.a(EntityHuman.java:651) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.EntityPlayer.a(EntityPlayer.java:144) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        at net.minecraft.server.v1_12_R1.Entity.f(Entity.java:1684) ~[PaperSpigot-1.12.2-b1375.jar:git-Paper-1375]
        ... 14 more

Now it ends in this ...

@azhangvo
Copy link

Can you tell us what server version you are running and what CraftPlayer file you are using?

@JustZerooo
Copy link

JustZerooo commented Mar 31, 2018

I use PaperSpigot-1.12.2-b1375 with the submittet CraftPlayer from this github page.

@azhangvo
Copy link

I personally haven't worked with PaperSpigot before but I would guess that the optimizations put in may have edited the craft player class. You may have to edit it yourself with the method described above.

@MatrixTunnel
Copy link

A work around was added in this commit not too long ago PaperMC/Paper@d09826f

@azhangvo
Copy link

azhangvo commented Apr 3, 2018

Cool! Also, I kind of wish I had changed the wording of my explanation on that first post. Sounds so cringey now.

@Seshpenguin
Copy link

Seshpenguin commented Jul 11, 2018

Just in case anyone else runs into this problem, a simple solution is to add -Dpaper.disableChannelLimit=true to the server flags (Ex: java -Dpaper.disableChannelLimit=true -jar PaperSpigot-latest.jar). This appears to be the best solution, though only supported on PaperSpigot.

@Landy005
Copy link

Can someone do this workaround for 1.14.4?

@JustMentalMatt
Copy link

is this possible on 1.19.x versions, i read somewhere that it doesnt work for anything past 1.13+ but im not sure as documentation and overall support for this issue seems scarce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests