Tiiffi/mcrcon

Certain commands return no output when run from mcrcon, but work when run from console directly

ASchneider-GitHub opened this issue · 1 comments

I'm attempting to monitor the TPS of the server using the Spark profiler. Running the tps command from the console normally returns:

[14:59:51] [Craft Scheduler Thread - 0/INFO]: [⚡] TPS from last 5s, 10s, 1m, 5m, 15m:
[14:59:51] [Craft Scheduler Thread - 0/INFO]: [⚡]  20.0, 20.0, *20.0, *20.0, *20.0
[14:59:51] [Craft Scheduler Thread - 0/INFO]: [⚡]
[14:59:51] [Craft Scheduler Thread - 0/INFO]: [⚡] CPU usage from last 10s, 1m, 15m:
[14:59:51] [Craft Scheduler Thread - 0/INFO]: [⚡]  1%, 4%, 4%  (system)
[14:59:51] [Craft Scheduler Thread - 0/INFO]: [⚡]  3%, 6%, 6%  (process)

However, when attempting to run it from mcrcon with terminal mode, or with ./mcrcon -p <password> tps, no data is returned. When running the tps command with ./mcrcon -p <password> tps, I can see the following messages in the console:

[15:01:47] [RCON Listener #1/INFO]: Thread RCON Client /127.0.0.1 started
[15:01:47] [RCON Client /127.0.0.1 #3/INFO]: Thread RCON Client /127.0.0.1 shutting down

It appears to connect successfully but then returns nothing. The EssentialsX lag command functions as intended when passing the command through the mcrcon binary, but doesn't contain the information I need. I run the server as a systemd service, so I don't have a way of directly accessing the console to run the command, leaving me with RCON. An example image of what I'm describing is attached. Is there a limitation of RCON that would produce this behaviour? The top shell is the server console from a test environment where Spark is running and RCON is enabled. The bottom shell is shows the results of running mcrcon against that test environment.

tpsNoOutput

This problem is related how rcon protocol is designed. Server can't send messages directly to rcon client, it has to be response to command. So it looks like that command has no response at all, but it prints it's result to console later on and that's why it is not visible on mcrcon.