Electroid / SportPaper

Performance-tuned Minecraft 1.8 server
Other
208 stars 76 forks source link

Native transport does not work after Java 8 #58

Open vytskalt opened 3 years ago

vytskalt commented 3 years ago

If you:

Then when you join the server, it will spam this Netty exception:

[Netty Epoll Server IO #1/WARN]: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.RuntimeException: Unable to access address of buffer
    at io.netty.channel.epoll.Native.read(Native Method) ~[server.jar:git-SportPaper-v1.0-16-g934b4b2]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.doReadBytes(EpollSocketChannel.java:678) [server.jar:git-SportPaper-v1.0-16-g934b4b2]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:714) [server.jar:git-SportPaper-v1.0-16-g934b4b2]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe$3.run(EpollSocketChannel.java:755) [server.jar:git-SportPaper-v1.0-16-g934b4b2]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [server.jar:git-SportPaper-v1.0-16-g934b4b2]
    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:268) [server.jar:git-SportPaper-v1.0-16-g934b4b2]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [server.jar:git-SportPaper-v1.0-16-g934b4b2]
    at java.base/java.lang.Thread.run(Thread.java:834) [?:?]

This issue is nothing new, but surely there's a way to fix it! Maybe just update Netty (the currently used version is about 6 years old)? The new versions of Java have a lot of performance improvements, that's why I would love to use them.

TheDGOfficial commented 3 years ago

That 6 year old netty would not support Java 9 without native transport (at least will not take advantages of it), too. Why not just use Java 8? I know later versions have many improvements but you are using an old Minecraft version, what you expect? If you're a latest bleeding-edge guy, then why not just use 1.16.5? If most of the patches, important fixes and such weren't backported to Java 8 maybe, but Java 8 is still supported and updated by Oracle/OpenJDK.

Besides, MC officialy switched to Java 8 on MC 1.12 too.. 1.8 was probably compiled with Java 6 and Spigot/Paper has reflection errors on Java 9+. Perhaps they are fixed in SportPaper, but that doesn't mean it will work out of the box with full Java 15 support or such. Keeping up to date every dependency like Netty on a 8ish year old code base is not easy.

Electroid commented 3 years ago

Netty is good with backwards-compatibility, so its possible we could bump it.

roccodev commented 3 years ago

https://github.com/CobbleSword/NachoSpigot/commit/0bd2d922776d46476ca5527c6d14423f51801fb1 Might be worth looking into this, though I'm not sure if you need to make that high of a jump (potentially introducing more incompatibilities), since I haven't tested it.

ghost commented 3 years ago

That NachoSpigot patch breaks a lot of plugins that expects older versions in 1.8.8, like ProtocolLib / Citizens, i gived a fix to ProtocolLib by doing a pr and tried the same with citizens but mcmonkey denied the pr because im a 'piracy supporter'

vytskalt commented 3 years ago

1.8 simply doesn't support Java >8 at all. It has many other issues.

I suggest closing this PR as updating Netty will break plugins and won't fix Java >8 compatibility at all.

This is possible, and has been proven by NachoSpigot:

Java 15 is now natively supported, and ProtocolLib and Citizens are patched at runtime to work with Nacho's patches. Nacho can now be used in production environments.

Speedy11CZ commented 3 years ago

After some testing, updating netty-all dependency to latest version will fix this error with native transport (and still working with ProtocolLib and other plugins)

vytskalt commented 3 years ago

After some testing, updating netty-all dependency to latest version will fix this error with native transport (and still working with ProtocolLib and other plugins)

Then why does NachoSpigot have to patch the plugins for them to work.?

Either way, if it truly doesn't break plugins I would love to see this added. New Java versions have a lot of performance improvements and some plugins are removing support for Java 8.

Askarionn commented 2 years ago

After some testing, updating netty-all dependency to latest version will fix this error with native transport (and still working with ProtocolLib and other plugins)

Then why does NachoSpigot have to patch the plugins for them to work.?

Either way, if it truly doesn't break plugins I would love to see this added. New Java versions have a lot of performance improvements and some plugins are removing support for Java 8.

I tested with NachoSpigot and official ViaVersion / ProtocolLib / etc versions and everything works fine, so it's possible to add support for newer Java Versions without patching other plugins.