koraktor / steam-condenser

A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
https://koraktor.de/steam-condenser
Other
356 stars 67 forks source link

Java - Exceptions in RCONSocket.getReply #293

Closed gkdevone closed 6 years ago

gkdevone commented 8 years ago

Hi,

first of all thanks for your library... really good job...

We use the steamcondenser 1.3.9 java library to communicate with our csgo servers.

Everything works fine but sometimes we get exceptions when trying to execute rcon commands (for example csgo status command).

The strange thing is that when we retry the failed command it will succeed most of the times.

So we have implemented a retry command mechanism in order to bypass these exceptions.

However occasionally we get java.lang.OutOfMemoryError on our server and I wonder if these exceptions might create a memory leak...

Can you pls take a look at the exceptions below and give us your opinion?

thanks

The most frequent exceptions we get are below:

Exception 1

java.lang.NegativeArraySizeException
    at com.github.koraktor.steamcondenser.steam.sockets.RCONSocket.getReply(RCONSocket.java:115)
    at com.github.koraktor.steamcondenser.steam.servers.SourceServer.rconExec(SourceServer.java:182)

Exception 2

java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at com.github.koraktor.steamcondenser.steam.sockets.RCONSocket.getReply(RCONSocket.java:119)
    at com.github.koraktor.steamcondenser.steam.servers.SourceServer.rconExec(SourceServer.java:182)

Exception 3

java.nio.BufferUnderflowException
    at java.nio.Buffer.nextGetIndex(Buffer.java:498)
    at java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:355)
    at com.github.koraktor.steamcondenser.steam.sockets.RCONSocket.getReply(RCONSocket.java:112)
    at com.github.koraktor.steamcondenser.steam.servers.SourceServer.rconExec(SourceServer.java:182)

Exception 4 (timeout is 3sec)

java.util.concurrent.TimeoutException
    at com.github.koraktor.steamcondenser.steam.sockets.SteamSocket.receivePacket(SteamSocket.java:112)
    at com.github.koraktor.steamcondenser.steam.sockets.RCONSocket.getReply(RCONSocket.java:118)
    at com.github.koraktor.steamcondenser.steam.servers.SourceServer.rconExec(SourceServer.java:182)
koraktor commented 8 years ago

You should not run into memory problems because of exceptions inside Steam Condenser’s code. I must admit, that the code isn’t fully tested for memory leaks, though. But you will probably have more success to pin these leaks down when you do memory profiling on your full code.

I’m especially worried by the first three exception types which would hint at corrupted data received from the servers. They’re all related to the packet size not being correctly transmitted in the first packet.

Timeouts may always happen for different reasons, I wouldn’t care about those if they happen rarely.

koraktor commented 6 years ago

After more than 2 years I don’t think there will be any additional information on this problem. Feel free to reopen if there is.