EcoIssues icon indicating copy to clipboard operation
EcoIssues copied to clipboard

[0.10.1.3] Long-output commands (e.g. `/helpful`) break RCON

Open shardwolfdotnet opened this issue 1 year ago • 0 comments

User Id: (slg231602) Version: 0.10.1.3 beta release-592

Steps to Reproduce:

  1. Start a dedicated server with RCON enabled (i.e. RCON password set, firewall rules enabled)
  2. Use an RCON client to open an authenticated RCON socket (I used mcrcon)
  3. Send the command helpful (or any other command that returns a large quantity of data)

Expected behavior: Response is either:

  • Fragmented across multiple response (see implementation notes for Minecraft RCON and Source RCON)
  • Truncated
  • Discarded and responded to with a clear error message

Actual behavior: Server throws the following exception and closes the RCON session:

System.ArgumentException: The output byte buffer is too small to contain the encoded data, encoding codepage '20127' and fallback 'System.Text.EncoderReplacementFallback'. (Parameter 'bytes')
   at System.Text.Encoding.ThrowBytesOverflow()
   at System.Text.Encoding.ThrowBytesOverflow(EncoderNLS encoder, Boolean nothingEncoded)
   at System.Text.Encoding.GetBytesWithFallback(ReadOnlySpan`1 chars, Int32 originalCharsLength, Span`1 bytes, Int32 originalBytesLength, EncoderNLS encoder)
   at System.Text.ASCIIEncoding.GetBytesWithFallback(ReadOnlySpan`1 chars, Int32 originalCharsLength, Span`1 bytes, Int32 originalBytesLength, EncoderNLS encoder)
   at System.Text.Encoding.GetBytesWithFallback(Char* pOriginalChars, Int32 originalCharCount, Byte* pOriginalBytes, Int32 originalByteCount, Int32 charsConsumedSoFar, Int32 bytesWrittenSoFar)
   at System.Text.ASCIIEncoding.GetBytes(String chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex)
   at Eco.Plugins.Rcon.RconPacket.WriteToAsync(NetworkStream stream, CancellationToken token)
   at Eco.Plugins.Rcon.RconClient.WritePacketAsync(RconPacket packet, CancellationToken token)
   at Eco.Plugins.Rcon.RconClient.PollConnection(CancellationToken token)

Do you have mods installed? Does the issue happen when no mods are installed?: No mods are installed.

shardwolfdotnet avatar Feb 03 '24 09:02 shardwolfdotnet