Page 1 of 1

IndexOutOfBoundsException in the LagMonitor class

Posted: 17 Nov 2014, 04:17
by hhd90
My client was sometime crashed by IndexOutOfBoundsException:
java.lang.IndexOutOfBoundsException: Invalid index 9, size is 9\n\tat java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)\n\tat java.util.ArrayList.get(ArrayList.java:304)\n\tat sfs2x.client.util.LagMonitor.getLastPingTime(LagMonitor.java:80)
I guess this error is caused by multi-thread. Is this a bug in the Java API client?

Re: IndexOutOfBoundsException in the LagMonitor class

Posted: 17 Nov 2014, 11:45
by Lapo
Hi,
what version of the API are you using?
See the SmartFox.getVersion() method.

If it's not a recent version please make sure to upgrade here:
http://www.smartfoxserver.com/download/sfs2x#p=client

Re: IndexOutOfBoundsException in the LagMonitor class

Posted: 17 Nov 2014, 12:10
by hhd90
Smartfox version: 1.3.4

Re: IndexOutOfBoundsException in the LagMonitor class

Posted: 17 Nov 2014, 12:15
by Lapo
What server version are you running?
Any ways in which we could try and reproduce the problem?

Can you show me your code for enabling the LagMonitor?

thanks

Re: IndexOutOfBoundsException in the LagMonitor class

Posted: 18 Nov 2014, 10:47
by hhd90
I enabled the LagMonitor after login successful:

Code: Select all

private void onLogin(BaseEvent event) {
       _sfsClient.enableLagMonitor(Config.LAG_MONITOR);
      .............
}
My client has already released to end user. In my client (android), I have implemented a method to send a mail to developer when the client was crashed. These days, I receive a lot of mails about this error. But I can't reproduce this error when I try test.

Re: IndexOutOfBoundsException in the LagMonitor class

Posted: 18 Nov 2014, 11:05
by Lapo
Neither can I.
In any case we'll take a closer look and see if we can release a quick patch for you to try.

I'll post an update here as soon as possible.

Cheers

Re: IndexOutOfBoundsException in the LagMonitor class

Posted: 18 Nov 2014, 11:17
by Lapo
UPDATE: I think it is an issue with internal synchronization, hence the difficulty in reproducing the issue on command.
We have fixed the issue.

It would be great if you could test the update and tell us if the problem has been removed.

If you want to do so, contact us directly by sending an email to our support@... email box, with a reference to this forum thread.

Hope it helps

Re: IndexOutOfBoundsException in the LagMonitor class

Posted: 20 Nov 2014, 04:48
by hhd90
Has this bug been fixed in the new version? When a new version is released?
In this time, I use try catch block to prevent this error. Thanks

Re: IndexOutOfBoundsException in the LagMonitor class

Posted: 20 Nov 2014, 09:29
by Lapo
Did you read my previous message?