setUserVariables - NullPointerException

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
vtween
Posts: 36
Joined: 26 Jul 2007, 17:31

setUserVariables - NullPointerException

Post by vtween »

Hi,

In our VW implementation we use ExtentionHelper.setUserVariables called by the ServerSide Extension (Java).
For some unxplained reason at times for some variable I get
java.lang.NullPointerException at it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.setUserVariables(ExtensionHelper.java:846)
Although I see everything fine in the SFS admin console and other uservariables are being set properly.
I have debugged the code up to the call to the ExtensionHelper and everything looks fine.
Since I have no access to the SFS codebase I would realy appriciate a hint of what is the null Object that causes the Exception.

Thanks,
Yohai Darom,
Virtual Tweens L.T.D.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Without seeing a line of code is quite difficult to help :(
Please help us to help you ;)
Lapo
--
gotoAndPlay()
...addicted to flash games
vtween
Posts: 36
Joined: 26 Jul 2007, 17:31

Post by vtween »

Here is the code:

Code: Select all

Map<String, UserVariable> uVars = new HashMap<String, UserVariable>();
UserVariable uVar = new UserVariable(item.toString(), UserVariable.TYPE_STRING);
uVars.put("item", uVar);
ExtensionHelper.instance().setUserVariables(u, uVars, true);            
However all the data I miss is the Object that may be null at line 846
(jysfs.jar - ver 1.6.2 pro.)
Or some descriptive error in the log file for future problem.

Thanks.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Is this problem happening constantly? It's not clear.
If it just happens once in a while it might be caused by the user getting disconnected before the operation is performed. This can happend when the ExtensioHandler message queue is very busy.
You should probably monitor it and and see if this happens frequently. Adding more threads via the <ExtHandlerThreads> tag would help in this case.
Lapo
--
gotoAndPlay()
...addicted to flash games
vtween
Posts: 36
Joined: 26 Jul 2007, 17:31

Post by vtween »

Thanks Lapo,

This problem happens periodically but constantly.
I have 20 ExtHandlerThreads active.
The load is not hight.
The wierd thing about it is that I can set any other paramater but this specific one for the same user while the problem occurs.
Once it occurs setting this parameter will persistantly throw this exception, until the user relogins.

Please, over what parameter does the method fail?
I'd really like to get into the root of the problem since it is a show stopper of our application.

Thanks again,
Yohai
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

I have 20 ExtHandlerThreads active.
This not a good value, unless you are doing a lot of thread blocking operations on the server side (db?)
4-6 threads are usually more than enough unless you run 16+ CPUs :)
Are you checking if the User is not null before calling setUserVariables?
Lapo
--
gotoAndPlay()
...addicted to flash games
vtween
Posts: 36
Joined: 26 Jul 2007, 17:31

Post by vtween »

Your assumption is correct.
I do alot of thread blocking operation on the server side.
Yes, most of them are DB realated.
I use 8 CPUs.

As I have tried to explain before the user is not null.
While the pronblem occurs I can set other user variables over this user.
Moreover, before I set the variable i send the user an extension response that it recieves fine and the user, according to the admin console and all the online clients is alive and online.

But for some reason this specific parameter at some point cannot be set.

Appriciate your advice.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

The problem might be related with the list of rooms joined by the user.
We have added a couple of extra checks in the upcoming patch (1.6.3) which will be out at the end of this week.

Stay tuned
Lapo
--
gotoAndPlay()
...addicted to flash games
vtween
Posts: 36
Joined: 26 Jul 2007, 17:31

Post by vtween »

Thanks
Post Reply