Stack Trace is empty

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

Moderators: Lapo, Bax

moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Stack Trace is empty

Postby moonlife » 29 Sep 2021, 11:36

Sometimes I get ArrayIndexOutOfBoundsException in my smartflox.log file caused by my Java extension. I'm using SFS 2.17.0.

Here is a sample error log:

Code: Select all

29 Sep 2021 | 13:42:00,720 | ERROR | SFSWorker:Ext:4 | controllers.v290.ExtensionReqController |     | java.lang.ArrayIndexOutOfBoundsException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.lang.ArrayIndexOutOfBoundsException
Message: *** Null ***
Description: Error while handling client request in extension: { Ext: GameExtension, Type: JAVA, Lev: ZONE, { Zone: gamezone }, {} }
Extension Cmd: roll_dice
+--- --- ---+
Stack Trace:
+--- --- ---+
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Why is my stack trace empty and how can I enable stack trace logs? Even if I could see only line numbers, that would be great.

In SFS Admin Panel, under Server Configurator->General, I've already enabled "Use debug-mode" and "Stats extra logging" options. Is there other settings that I can change to enable stack trace for my Java extension? (P.S: roll_dice extension extends BaseClientRequestHandler, it's called by a User).
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Stack Trace is empty

Postby Lapo » 29 Sep 2021, 13:34

Hi,
it's difficult to say. You should definitely find a stack trace, but the message being "*** Null ***" suggests another issue happened during the handling of the exception. Probably an NPE.

I'd suggest starting with a quick review of the class handling the roll_dice request, making sure to defend against the array problem (i.e. requesting an index that doesn't exist).

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

Re: Stack Trace is empty

Postby Lapo » 29 Sep 2021, 13:37

Sorry, small correction to what said above.
The ***Null*** label simply indicates that the error raised has a null message. In other words the original exception's message is empty.

So there wasn't a secondary NPE, while handling the main error as originally supposed. Not sure why the stack trace is missing though. We are checking the error reporting system for any potential issues on that front.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: Stack Trace is empty

Postby moonlife » 05 Oct 2021, 08:32

Hi,
Did you find any clues about the situation? Stack trace messages in our error logs are still empty, and it makes it very hard to detect reasons of errors for us.
Is there any information that we can provide to find out why can't we get stack trace messages?
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Stack Trace is empty

Postby Lapo » 05 Oct 2021, 11:14

Hi,
I was going to post an update but you beat me to it :)
We didn't find any specific issues on our side. However we found that it is possible that a Java exception is raised without a stack trace. This can happen in HotSpot JVMs after runtime compilation/optimization, as we found mentioned here:
https://try2explore.com/questions/10023908

They also suggest to add a specific JVM switch to bring the stack traces back. You could try adding the switch to your config, via the AdminTool > Server Settings > JVM Settings

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: Stack Trace is empty

Postby moonlife » 05 Oct 2021, 13:32

Thank you very much, added -XX:-OmitStackTraceInFastThrow switch to JVM settings, and it worked like a charm! Now we can see detailed stack trace info in our error logs.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Stack Trace is empty

Postby Lapo » 05 Oct 2021, 15:14

Excellent! :)
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 44 guests