ProtocolLib

3M Downloads

Incompatibility with Discord4J

gdude2002 opened this issue · 8 comments

commented

Bit of a different ticket for you guys. This isn't an issue with the mechanics of ProtocolLib where it comes to Bukkit per se - but I've discovered that it breaks Discord4J, raising the traceback at the bottom of this ticket.

Having done some testing with various versions of Paper and several plugin configurations, the only conclusion I could come to is that D4J and ProtocolLib are incompatible somehow.

MC Version: 1.14.4
Paper: 177 through 186
ProtocolLib: 4.4.0
Discord4J: 3.0.8

Any ideas?


[23:01:41 WARN]: [io.netty.util.ReferenceCountUtil] Failed to release a message: BinaryWebSocketFrame(data: PooledUnsafeDirectByteBuf(freed))
io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
	at io.netty.buffer.AbstractReferenceCountedByteBuf.release0(AbstractReferenceCountedByteBuf.java:100) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:84) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.buffer.DefaultByteBufHolder.release(DefaultByteBufHolder.java:117) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:88) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.util.ReferenceCountUtil.safeRelease(ReferenceCountUtil.java:113) ~[patched_1.14.4.jar:git-Paper-186]
	at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:120) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[patched_1.14.4.jar:git-Paper-186]
	at discord4j.common.close.CloseHandlerAdapter.channelRead(CloseHandlerAdapter.java:44) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1407) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1177) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1221) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:808) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:408) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:308) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) ~[patched_1.14.4.jar:git-Paper-186]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[patched_1.14.4.jar:git-Paper-186]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
commented

To clarify, Discord4J is entirely unable to hold up a connection to the Discord gateway, which is a Websocket. It functions perfectly when ProtocolLib is not present.

commented

I'm not familiar with that particular framework, but did you try opening an issue on their end?

commented

Yep yep, I've been talking to them about it for a couple days now.

They really don't have any ideas so far - I think they're planning on updating to a later reactor/reactor-netty, but they basically don't have any ideas.


Pretty much the only certainty I have is that this issue appears whenever there's a plugin on the server that intercepts or manually writes MC packets (so it's not just ProtocolLib at this point). I can't get around it using any shading or timing tricks, either.

Unfortunately I'm not familiar with Netty at all, so I'm not sure what else to look at either.

commented

My only guess is that it's sending netty requests over the same pipeline that minecraft packets get sent, so ProtocolLib tries to handle it like it's a packet. If that is the case, there's probably a way to get PL to ignore it. I would have to look into how they do it, though.

commented

I guess it probably does assume it's the only thing using Netty, yeah.

Do you think there's anything the D4J devs can do about it, since it's not just PL that's causing this?

commented

Potentially, depending on how they actually do it. But again, it's hard to say without looking into further

commented
commented

I have been able to tie this in with another external factor - the Docker container I have to use. Unfortunately I don't have control over this container, but this is esoteric enough that I don't really think it's your problem.

Thanks for looking into it all the same, though!