Page 1 of 1

setUserVariables - NullPointerException

Posted: 07 Aug 2008, 11:15
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.

Posted: 07 Aug 2008, 13:33
by Lapo
Without seeing a line of code is quite difficult to help :(
Please help us to help you ;)

Posted: 07 Aug 2008, 13:57
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.

Posted: 08 Aug 2008, 12:31
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.

Posted: 10 Aug 2008, 04:36
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

Posted: 10 Aug 2008, 05:45
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?

Posted: 10 Aug 2008, 05:56
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.

Posted: 12 Aug 2008, 08:29
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

Posted: 12 Aug 2008, 11:09
by vtween
Thanks