koraktor/steam-condenser — Issue #144: Exceptions on Source server RCON commands that have no response
Author: milkmansrevenge
Created: 2012-01-16 16:12:15+00:00
State: open

Hey,

I am getting exceptions when executing RCON commands on Counter-Strike: Source servers if those RCON commands do not have any response. For example:

GameServer server = new SourceServer(ip, port);
server.rconAuth(password);
String output = server.rconExec("say hello");
logger.info("Output: {}", output);
output = server.rconExec("status");
logger.info("Output: {}", output);
output = server.rconExec("mp_c4timer 15");
logger.info("Output: {}", output);

Will run as expected until trying to exec "mp_c4timer 15" where an Exception will be thrown due to the fact that there is no data to read from the socket. However the command still gets run on the server fine. Example stacktrace below:

java.util.concurrent.TimeoutException: null
at com.github.koraktor.steamcondenser.steam.sockets.SteamSocket.receivePacket(SteamSocket.java:111) ~[steam-condenser-1.0.1.jar:na]
at com.github.koraktor.steamcondenser.steam.sockets.RCONSocket.getReply(RCONSocket.java:103) ~[steam-condenser-1.0.1.jar:na]
at com.github.koraktor.steamcondenser.steam.servers.SourceServer.rconExec(SourceServer.java:162) ~[steam-condenser-1.0.1.jar:na]
at com.example.RconStuff.doStuff(RconStuff.java:97) ~[Example-0.1.0.jar:na]

Similarly but not quite the same, I get SteamCondenserException when doing a "_restart" command on the server.

com.github.koraktor.steamcondenser.exceptions.SteamCondenserException: Connection reset by peer
at com.github.koraktor.steamcondenser.steam.sockets.SteamSocket.receivePacket(SteamSocket.java:132) ~[steam-condenser-1.0.1.jar:na]
at com.github.koraktor.steamcondenser.steam.sockets.RCONSocket.getReply(RCONSocket.java:103) ~[steam-condenser-1.0.1.jar:na]
at com.github.koraktor.steamcondenser.steam.servers.SourceServer.rconExec(SourceServer.java:162) ~[steam-condenser-1.0.1.jar:na]
at com.example.RconStuff.doStuff(RconStuff.java:97) ~[Example-0.1.0.jar:na]
Caused by: java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.read0(Native Method) ~[na:1.6.0_18]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[na:1.6.0_18]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:251) ~[na:1.6.0_18]
at sun.nio.ch.IOUtil.read(IOUtil.java:224) ~[na:1.6.0_18]
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:254) ~[na:1.6.0_18]
at com.github.koraktor.steamcondenser.steam.sockets.SteamSocket.receivePacket(SteamSocket.java:122) ~[steam-condenser-1.0.1.jar:na]
... 9 common frames omitted

It should be noted that I did not experience these problems on Counter-Strike 1.6 servers (GoldSrc). I couldn't really test the first issue described here because all commands seem to have some kind of response that they send back. But issuing a "restart" to the 1.6 servers works just fine, without any exceptions.