Skip to content

ServerCommandEx() can't grab stats output #967

@CrazyHackGUT

Description

@CrazyHackGUT

Help us help you

  • I have checked that my issue doesn't exist yet.
  • I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
  • I can always reproduce the issue with the provided description below.

Environments

Parameter Windows Linux
Game Client App ID 440 440
Game Server App ID 232250 232250
SourceMod Version 1.9.0.6275 1.9.0.6237
MetaMod Version 1.10.7-dev 1.11.0-dev+1105

Description

It looks like ServerCommandEx() can't grab output for any command (if executed via server console), if this call placed in command handler, and can "kill" server if used in another subcommand with ServerCommandEx().

Problematic Code (or Steps to Reproduce)

#include <sourcemod>

public void OnPluginStart()
{
  RegConsoleCmd("sm_stats", CmdStats);
}

public Action CmdStats(int iClient, int iArgC)
{
  char szBuffer[512];
  ServerCommandEx(szBuffer, sizeof(szBuffer), "stats");
  
  ReplyToCommand(iClient, "Command length response: %d", strlen(szBuffer));
  ReplyToCommand(iClient, "Command output:\n%s", szBuffer);
  return Plugin_Handled;
}
  1. Join to server with admin with access to sm_rcon.
  2. Execute sm_rcon stats. Receive output (all ok).
  3. Execute sm_stats. Receive output (all ok).
    Server runs ok
  4. Execute sm_rcon sm_stats, get a server freeze. Fatal freeze. He don't unfreeze.
    In Task Manager, SRCDS uses fully one server CPU.
    Server Freeze

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions