Server Connectivity and Message Issues


I configured my client properly now, and I’m no longer having issues on that end. I am now experiencing an error regarding my server now. I’ve done a bit of research on this forum, and I haven’t found a solution yet, but I have tried a few things that I’ve read about. Here’s my issue:

I have tested and successfully connected both local and external (LAN and not LAN) clients to my server. The server tells them information about the world so that it can be rendered, and the client can then move about freely, as should be. The issue I’m having is an error(s) that occurs when I try to connect to the server from any computer other than the one the server is running on. The error is as follows:

Jul 24, 2012 3:09:28 AM reportError
SEVERE: Unhanddled kernel error An established connection was aborted by the software in your host machine
at Method)

Jul 24, 2012 3:10:06 AM handleError
SEVERE: Uncaught exception thrown in Thread[Headless Application Thread,5,main]
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapByteBuffer.(
at java.nio.ByteBuffer.allocate(
at Server.MyGameServer.simpleUpdate(

From reading other posts, I've learned that the Java heap space error may be the program running out of memory, but I've tried increasing its memory to 512m and to 1024m, and it still appears with this error. There is nothing in my code that would take this much memory, so I suspect I have a leak.

One thing that may be the cause is my method of "player markers". Essentially, the way this runs, when a player moves, it tells the server the new location. Upon receiving the new location, the server updates an array of player locations that it contains. The server then broadcasts player locations in the simpleUpdate method. Something I notice is that although the external clients connect successfully, they do not seem to receive any of this location data. Clients run from the host machine, however, do.

The line of the error message that says "An established connection was aborted by the software in your host machine" confuses me, as well. Normally, I would expect this to be the cause of my troubles, but when that client does disconnect, the server still receives a message from it.

Is there enough information here to piece together a solution, or would you prefer to see any of my code?

Thank you for any assistance you can offer,

How do you send the data ? fixed intevalls or per frame? What if the client has extremly high fps (1000+) ?

“Still receives message from it”… are they reliable or unreliable messages?

There is more going on here than meets the eye, I think. Do the TestChatServer and TestChatClient also behave this way on your machines?

I think the first error is somehow inducing a condition in your application that causes broadcasting to run amok. Otherwise I cannot explain why it doesn’t overwhelm memory when you connect locally.

Does the non-local client ever receive updates from the server? Are there any errors when it runs? Are you even capturing the errors there? Are you sure that the client is the right version on the other machine?

If the client never receives a message then it’s because that client has blocked the network packets for some reason or because it is actually failing to read the message and partially crashing or something.

I’m really just guessing at this point.

I send the data per frame, but I don’t think that is the issue since it works locally.

They are reliable messages.

The TestChat programs work without issue.

The non-local client receives the data to create the world (Which skybox to use, which terrain to load, etc). They are all strings, and they all load properly. It seems that the simpleUpdate() broadcasts are what isn’t getting through to external clients.

There are absolutely no errors showing up in my client while it’s running, and I’m positive that it is the correct version.

I’d think it was an issue with the firewall as well, but I’ve tried it with firewalls enabled and disabled, and it makes no difference. Those first few messages still get through.

Here is my broadcast code:


for (int i = 0; i < player.length; i++) {

gameServer.broadcast( new BasicMessage(“plrX”, “” + player.getPlrID(), player.getX()) );

gameServer.broadcast( new BasicMessage(“plrY”, “” + player.getPlrID(), player.getY() - 11.6f) );

gameServer.broadcast( new BasicMessage(“plrZ”, “” + player.getPlrID(), player.getZ()) );

gameServer.broadcast( new BasicMessage(“plrRot”, “” + player.getPlrID(), player.getRot()) );



gameServer is my Server

I have an array of player objects that I created to store location data named “player”.

BasicMessage sends two strings and a float, since I use it for more than just this purpose. On the other end, I turn the second String into an integer. The first String tells the client listener what the message is, and the float is the actual value.

getX = X Location

getY = Y Location

getZ = Z Location

getRot = Player Rotation (Facing)

The client uses the player’s ID to know which player object to move.

Can you paste in your BasicMessage class?

Do you log the message at the other end when it is received? Before doing anything else with it?

My computer gets 3000fps on basic scenes. If you are trying to send positional data from the client to the server 3000 times a second then it’s going to flood the server. Maybe local can cope (as it will just go over the loopback) but over remote the extra delays are causing problems? Particularly on reliable where any failures need retrying while new messages are piling up behind.

Either way it’s poor network design to send that many messages. You need to cut it down to only sending important things (and really networking comms should be independent from frame rate).

Is there any chance the messages are going over the size limit of messages? (Is there a size limit in spidermonkey?).

Have you tried running up the java monitoring stuff (jconsole) and looking at what memory usage is doing?

1 Like

I considered what Zarch said, and decided to try it out.

Limiting my server output seems to have fixed the issue. I’ll post again if the issue returns. Thanks!