Page 1 of 1

SetInterval Error on Server Restart

Posted: 21 Mar 2007, 11:23
by Ganius
I have come across this issue a few times now, so I felt it worth reporting...

On my server side extension, I keep a number of global arrays, which I use SetInterval() to check and change on a regular basis. There seems to be no problem when these arrays are empty, but if there is data inside one of the arrays and I change and save my extension, the array still contains the old information.

Firstly I would have assumed that the array gets wiped clean when reloading the extension. If not, that's fine - it's obviously being held in the machines memory. So to remove this array from memory, I use the admin tool to restart SmartFox Server.

The problem is that when SFS starts back up, the following error keeps pumping out:

Code: Select all

2007/03/21 12:35:05.485 - [ WARNING ] [id: 19] (JavascriptExtension$IntervalExecutor.run): SetInterval Error: Wrapped java.lang.NullPointerException (myextension.as#231)
2007/03/21 12:35:05.485 - [ WARNING ] [id: 19] (JavascriptExtension.logASError): Error in extension [ myextension.as ]: Wrapped java.lang.NullPointerException (myextension.as#231) Internal: -1044 -- Line number:  (MainLib line: 231)
The only way I can get rid of this is to reboot the entire machine that SFS is running on. Then everything runs perfectly.

Currently it's not that big of an issue, and I imagine in a production environment that I won't be changing the extension too much, but I felt it worth reporting...

Cheers,
G.

Posted: 23 Mar 2007, 10:17
by Lapo
are you clearing the interval(s) with clearInterval in the destroy() method of your extension?

Posted: 27 Mar 2007, 16:41
by Ganius
It seems I had forgotten to clear one of my Intervals, and now all seems fine.

Thanks!!

G.