Java error I'm getting in extension

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

Moderators: Lapo, Bax

Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 22 Dec 2007, 17:37

Crashed again after 1 hour 20 mins. Darn....
Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 22 Dec 2007, 18:07

I just found a BIG clue I think. I just noticed something - it may be nothing BUT....

[/got/instance2.as]: About to create room: C610
[/got/instance2.as]: About to create room: C511

Notice that I never got a room created message from the first room!

I had a room being created.... then before I got the notice that Room Extension created! Another room was starting to get created... Then it crashed...

Could this possibly corrupt the hash map (i.e. room vars) when two rooms get created (before the other one returns) using room variables???? Hash Maps aren't thread safe...

I'm going to try and just pass all my variables as ConcurrentHashMap by reference for now - and not use any room variables - see if that helps anything.
Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 22 Dec 2007, 19:10

So much for that theory - still crashed - same Java error.
User avatar
darnpunk
Posts: 229
Joined: 22 Jun 2007, 02:58
Location: SG

Postby darnpunk » 22 Dec 2007, 23:55

Hi Kicksome,

Don't give up! I'm sure we'll find something there. I think it is definitely somewhere around the line createRoom. One thing I noticed too is that sometimes my extension don't get attached to my rooms or it somehow got "leaked" to other rooms.

I tried to replicated the problem by creating 200 rooms in a loop from the server and sometimes it will give an error "Unrecognized extension name" and when that happens, everything goes wild. That doesn't happen so much anymore or all the time. That's one of the error I got. I forgot to mention that I attach a room extension to my game rooms.

However, I strongly believe it's got to do with the whole process of creating a room + attaching custom properties to it and also a timer to check for empty rooms. Someone is trying to access something not there? I'll try to switch the search for empty game rooms off and see if that helps.

I wish I can replicate the problem in a much shorter time. 26 hours just isn't going to make the debugging any better :x If I can reproduce it faster, I can do a test on it on a local test server. I'll try again!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 23 Dec 2007, 09:00

A couple of comments:
An EXCEPTION_ACCESS_VIOLATION is an error caused by the JVM trying to access a portion of memory that the process is not allowed to read.
In other words the cause of this error could be found deep down in the guts of the JVM more than in the SmartFoxServer Extension code.

Of course it is also possible that a certain combination of bytecodes produces the error under certain circumstances but in the end this should not cause a native exception and I guess that only a Sun JVM Engineer could find out the real culprit.

As I already mentioned in another post there are a few things that you should try:

1. Use the server version of the JVM. For some weird reason the Linux JRE comes with both versions of the JVM while the Windows version doesn't. :(
In order to run the server version of the JVM you will have to dowload the Java SDK (Software Development Kit) and use the JRE contained in that package

In order to run the server JVM you simply add the "-server" command line parameter.

2. Try another version of the JRE
(for example the the latest 1.5.x available)

3. Change the Rhino library version: SFS uses Mozilla Rhino Javascript engine for the AS runtime. You could revert to an earlier version to see if there's a problem with this library

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 23 Dec 2007, 14:04

Thanks Lapo. I'm running it right now as -sever in the dos box to see if that helps things.
Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 23 Dec 2007, 14:54

Just for the record for some reason I searched on server and couldn't find anything in the forums.

To run the JVM in server mode on Windows 2003 server I had to do the following....

1) Download the JDK from sun.
2) Install it
3) Stop SFS. Rename the smartfoxserverpro_1.6.0/jre to jre_bak
4) copy the sun jre to smartfox server directory
5) edit the wrapper.conf and add the -server option like this:
# Java Additional Parameters
wrapper.java.additional.1=-server
wrapper.java.additional.2=-Dfile.encoding=UTF-8
wrapper.java.additional.3=-Djava.util.logging.config.file=logging.properties

Start the server in the service control panel as usual in windows. In the logs you'll see: Notice Server VM
INFO | jvm 1 | 2007/12/23 10:08:00 | java.vm.version: 1.6.0_03-b05
INFO | jvm 1 | 2007/12/23 10:08:00 | java.vm.vendor: Sun Microsystems Inc.
INFO | jvm 1 | 2007/12/23 10:08:00 | java.vm.name: Java HotSpot(TM) Server VM

VS the old (Notice Client VM)
INFO | jvm 1 | 2007/12/23 00:33:55 | java.vm.version: 1.6.0_03-b05
INFO | jvm 1 | 2007/12/23 00:33:55 | java.vm.vendor: Sun Microsystems Inc.
INFO | jvm 1 | 2007/12/23 00:33:55 | java.vm.name: Java HotSpot(TM) Client VM
Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 23 Dec 2007, 17:34

The -server thing didn't fix my problem although it seemed to run much better in general. So I just tried downgrading my java SDK to 1.5.0_14.

I'm hoping for a x-mas miracle! If not, looks like I'll be spending x-mas working on my java extensions.

-Kick
Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 23 Dec 2007, 22:47

Well - I just installed the 1.5.0_14 java.

And it works!!! Or at least it's worked for the past 5 hours which is 3 hours longer than it's ever worked before.

I was talking to a friend of mine who does java coding for a living with the government and he said 1.6 was VERY unstable (at least for what they are doing) and they aren't even allowed to use it since it causes so many problems.

Wow - I'm still in shock. Can't believe downgrading the JRE worked!!!

Thanks for the help!
User avatar
darnpunk
Posts: 229
Joined: 22 Jun 2007, 02:58
Location: SG

Postby darnpunk » 24 Dec 2007, 00:23

I am going to try it right away! Oh anyway Kicksome, did you use the server version of that build?
Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 24 Dec 2007, 01:26

I downloaded the 1.5.0_14 JDK and I run it as server (I used the jre in the sdk dir). I also notice that is uses up all the memory that I specify unlike 1.6. If I say use 1 gig it'll use 1 gig. 1.6 never even got close to using the min memory I specified.
User avatar
darnpunk
Posts: 229
Joined: 22 Jun 2007, 02:58
Location: SG

Postby darnpunk » 24 Dec 2007, 01:26

I just restarted my SFS on 1.5.0_14 but client version. I am assuming you're using the server version of that build Kicksome? So if yours work, I'll have to wait for mine to justify if it really is the build that works. Or if only the server version of that build works. I'll update my observations as soon as I get any news of it (26 hours from now :x ). Let's hope we'll have a good christmas!

Regards,
darnpunk
User avatar
darnpunk
Posts: 229
Joined: 22 Jun 2007, 02:58
Location: SG

Postby darnpunk » 25 Dec 2007, 05:04

Looks like things are going well with JVM 1.5.0_14 be it client or server version! My SFS instance is running for about 28 hours now which is longer than the usual 26 hours. So now it's more stable but now my question is, will I be missing out on anything by downgrading JVM on the machine? Speed? Performance?

I'll observe for a few days and see if the issue is really gone for good. Anyway, MERRY CHRISTMAS to everyone!
User avatar
darnpunk
Posts: 229
Joined: 22 Jun 2007, 02:58
Location: SG

Postby darnpunk » 25 Dec 2007, 14:33

Hi,

Seems the server is still running but I do have problem. Whenever I log into the Admin Tool, it takes forever to load the statistics under server info (the default page upon login). I checked in the console that everytime I try to access that section it returns an error:

Code: Select all

[ WARNING ] [id: 12] (ExtensionHandler.processEvent): String message in wrong format: java.lang.ArrayIndexOutOfBoundsException: 83


Nothing will show even after minutes of waiting. It just keeps trying to read something. Still using SFS 1.5.5 PRO. This started to happen only after I downgraded my JVM. The other sections operates fine. Any clues?

Regards,
darnpunk
Kicksome
Posts: 52
Joined: 01 Sep 2007, 02:25
Contact:

Postby Kicksome » 25 Dec 2007, 14:37

I'm using SFS 1.6.0 ... No idea :(

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 34 guests