Admin Tool fails to connect with Amazon Corretto 16

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

MetaJordan
Posts: 7
Joined: 03 Dec 2021, 16:53

Admin Tool fails to connect with Amazon Corretto 16

Postby MetaJordan » 03 Dec 2021, 17:05

Everything else seems to work fine, though. This is with the --illegal-access=permit flag, of course.

Also just curious, but any plans to support JDK 17? I imagine there are additional reflection issues...

08:57:17,069 WARN [http-nio-8080-exec-1] websocket.SFS2XWSService - Upgradre request data not found for: [0:0:0:0:0:0:0:1]:62031
08:57:17,081 WARN [SFSWorker:Sys:3] v290.SystemReqController - java.lang.NullPointerException: Cannot invoke "com.smartfoxserver.bitswarm.sessions.ISession.getFullIpAddress()" because "session" is null
com.smartfoxserver.v2.util.CryptoUtils.getUniqueSessionToken(CryptoUtils.java:34)
com.smartfoxserver.v2.controllers.system.Handshake.execute(Handshake.java:107)
com.smartfoxserver.v2.controllers.v290.SystemReqController.processRequest(SystemReqController.java:172)
com.smartfoxserver.v2.controllers.v290.SystemReqController.enqueueRequest(SystemReqController.java:127)
com.smartfoxserver.bitswarm.io.protocols.AbstractProtocolCodec.dispatchRequestToController(AbstractProtocolCodec.java:39)
com.smartfoxserver.bitswarm.websocket.tomcat.WebSocketBinaryProtocolCodec.dispatchRequest(WebSocketBinaryProtocolCodec.java:217)
com.smartfoxserver.bitswarm.websocket.tomcat.WebSocketBinaryProtocolCodec.onPacketRead(WebSocketBinaryProtocolCodec.java:78)
sfs2x.ws.tomcat.websocket.SFS2XWSService$WSIOExecutor.run(SFS2XWSService.java:520)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
java.base/java.lang.Thread.run(Thread.java:831)
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby Lapo » 04 Dec 2021, 05:54

Hi,
please take a look here:
http://docs2x.smartfoxserver.com/Advanc ... patibility

In short, if you use a Java version >= 16 you will need to add an extra switch (--illegal-access=permit) to the JRE startup parameters.
This can be added in the local sfs2x-service.vmoptions file.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby Lapo » 04 Dec 2021, 06:22

Also just curious, but any plans to support JDK 17? I imagine there are additional reflection issues...

Yes, that's correct. With JDK 17 the --illegal-access=permit switch has been removed, so there are no options to run SFS2X beyond Java 16.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
MetaJordan
Posts: 7
Joined: 03 Dec 2021, 16:53

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby MetaJordan » 04 Dec 2021, 07:04

Lapo wrote:Hi,
please take a look here:
http://docs2x.smartfoxserver.com/Advanc ... patibility

In short, if you use a Java version >= 16 you will need to add an extra switch (--illegal-access=permit) to the JRE startup parameters.
This can be added in the local sfs2x-service.vmoptions file.

Cheers


Hi, thank you for the quick reply! Yes, I've already added this switch to the sfs2x-standalone.vmoptions file. The server runs without any problems during gameplay. I only get that exception when I try to connect to the admin tool.

Lapo wrote:
Also just curious, but any plans to support JDK 17? I imagine there are additional reflection issues...

Yes, that's correct. With JDK 17 the --illegal-access=permit switch has been removed, so there are no options to run SFS2X beyond Java 16.

Cheers


I understand but do you have any future plans/roadmap to get around the fact that the switch has now been removed? Or are all future Java versions essentially off the table?
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby Lapo » 05 Dec 2021, 15:50

The server runs without any problems during gameplay. I only get that exception when I try to connect to the admin tool.

Can you give us more details?
Is it a server side error? A client side one?

(I have tested this setup on a Linux box and didn't see any issues with the AdminTool.)

I understand but do you have any future plans/roadmap to get around the fact that the switch has now been removed? Or are all future Java versions essentially off the table?

We don't have immediate plans to support Java 17 and higher.
While the drastic acceleration of the JRE releases is fascinating it's also not possible for us to keep up with everything, especially when it requires major rewrites of entire server modules that are very stable.
We tend to prioritize stability and reliability over following the latest trends, especially when there's no evident benefit in doing so.

This is not to say that we're uninterested in what the Java platform will offer with the next releases. Java 18 will bring "Project Loom" (aka virtual threads) which is interesting and could potentially have a beneficial impact on the server's performance.
But we won't be in the front line with early adopters. We'll have to see it in action, perform a significant amount of tests and evaluate what are the benefit in our specific context. (We have already experimented with an early access JDK 18 and so far have found mixed results, so we're waiting for the final release)

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
MetaJordan
Posts: 7
Joined: 03 Dec 2021, 16:53

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby MetaJordan » 06 Dec 2021, 16:14

Lapo wrote:
The server runs without any problems during gameplay. I only get that exception when I try to connect to the admin tool.

Can you give us more details?
Is it a server side error? A client side one?

(I have tested this setup on a Linux box and didn't see any issues with the AdminTool.)


Thanks for the detailed explanation regarding the JDK!

Regarding the error, it is purely server-side. The client is a modified version of the MMORoom demo (but this admin tool error happens even without a single client running or ever connecting). I am running SFS2X on Windows 11 as standalone. As mentioned before I'm using Amazon Corretto 16 instead of the prepackaged JDK. I've added the full server log, java trace, and vmoptions file as attachments. To reproduce the error:

1. Run the SFS2X server as standalone.
2. Wait for server to finish starting up.
3. Open the admin tool in a new tab (I'm using Chrome 96.0.4664.45).
4. Enter default username/password.
5. Click the "Connect" button.
6. See the exception in the server log. Also the admin tool displays in red at the bottom: "A disconnection occurred due to unknown reason; please reconnect"

One last possibility is that the project is git version controlled with the jre folder ignored so it's added as a symbolic link (with the mklink -d command). Maybe that has something to do with it?
Attachments
adminerror.7z
(5.48 KiB) Downloaded 248 times
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby Lapo » 06 Dec 2021, 17:30

I don't think the Git versioning has anything to do with this.
We'll test with the same JRE to check if there's any difference (I have tested with an AdoptJDK 16)

As regards the errors I noticed that the client is calling from 0:0:0:0:0:0:0:1, which is the IPv6 localhost. Maybe the error is due to that.
Have you tried connecting with a client connected from the Internet?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
MetaJordan
Posts: 7
Joined: 03 Dec 2021, 16:53

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby MetaJordan » 06 Dec 2021, 17:50

Lapo wrote:I don't think the Git versioning has anything to do with this.
We'll test with the same JRE to check if there's any difference (I have tested with an AdoptJDK 16)


Yeah I just tried with a non-symlinked jre folder and I still get the same error, so that's not it. I also tried again with the embedded JRE 8 and the admin tool works fine, so it's definitely something related to the JRE in general.

Lapo wrote:As regards the errors I noticed that the client is calling from 0:0:0:0:0:0:0:1, which is the IPv6 localhost. Maybe the error is due to that.
Have you tried connecting with a client connected from the Internet?

Thanks


Sorry I'm not totally sure what you're asking. Since I'm running the server on my local machine I've forwarded all of the necessary ports and have had multiple clients connect to the MMORoom demo remotely (different network and everything).

If you're referring to this warning:

06 Dec 2021 | 07:50:44,121 | WARN | http-nio-8080-exec-1 | tomcat.websocket.SFS2XWSService | | Upgradre request data not found for: [0:0:0:0:0:0:0:1]:52367

Then I should also note that it is logged at the exact same time as the NullPointerException (when I click the connect button on the admin tool).
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby Lapo » 06 Dec 2021, 17:51

Update: I've tested with Corretto 16 and noticed the problem right away, which doesn't appear using AdoptJDK 16.
It seems like Corretto prioritizes IPv6 over IPv4. But it also highlights some issues with IPv6 Websocket clients that we need to investigate.

To work around this issue, which is likely to appear only when testing from localhost, you can add an extra JVM switch:

Code: Select all

-Djava.net.preferIPv4Stack=true


To learn more see here:
https://docs.oracle.com/en/java/javase/ ... rties.html

Thanks for reporting.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby Lapo » 06 Dec 2021, 17:53

Sorry I'm not totally sure what you're asking

I was asking if you tried to connect via AdminTool from the internet rather than localhost.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
MetaJordan
Posts: 7
Joined: 03 Dec 2021, 16:53

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby MetaJordan » 06 Dec 2021, 18:03

Lapo wrote:Update: I've tested with Corretto 16 and noticed the problem right away, which doesn't appear using AdoptJDK 16.
It seems like Corretto prioritizes IPv6 over IPv4. But it also highlights some issues with IPv6 Websocket clients that we need to investigate.

To work around this issue, which is likely to appear only when testing from localhost, you can add an extra JVM switch:

Code: Select all

-Djava.net.preferIPv4Stack=true


To learn more see here:
https://docs.oracle.com/en/java/javase/ ... rties.html

Thanks for reporting.


You're welcome! I just tried adding the switch and it all works fine now, thanks!

Lapo wrote:
Sorry I'm not totally sure what you're asking

I was asking if you tried to connect via AdminTool from the internet rather than localhost.

Cheers


Oh I see. Yeah I just tried this as well and it also works fine.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin Tool fails to connect with Amazon Corretto 16

Postby Lapo » 07 Dec 2021, 08:26

As a quick test we have tried forcing the IPv6Stack on JRE 11 based SFS2X and did not find the same issue. I would have expected the same problem to show up. We'll have to investigate this more deeply.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 40 guests