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

Native transport does not work after Java 8 #58

Open
vytskalt opened this issue Mar 8, 2021 · 8 comments
Open

Native transport does not work after Java 8 #58

vytskalt opened this issue Mar 8, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@vytskalt
Copy link
Contributor

vytskalt commented Mar 8, 2021

If you:

  • Are on Java >8.
  • Are on Linux.
  • Have use-native-transport set to true in server.properties which improves the performance on Linux.

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
Copy link

TheDGOfficial commented Mar 8, 2021

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
Copy link
Owner

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

@Electroid Electroid changed the title Incompatibility on Linux with Java >8 Native transport does not work after Java 8 Mar 19, 2021
@Electroid Electroid added the bug Something isn't working label Mar 19, 2021
@roccodev
Copy link
Contributor

CobbleSword/NachoSpigot@0bd2d92 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
Copy link

ghost commented Mar 28, 2021

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
Copy link
Contributor Author

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
Copy link

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
Copy link
Contributor Author

vytskalt commented Oct 3, 2021

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants