FAForever / server

The servercode for the Forged Alliance Forever lobby
http://www.faforever.com
GNU General Public License v3.0
67 stars 62 forks source link

Messages using SimpleJsonProtocol are limited to 64 KiB (LimitOverrunError) #939

Closed Askaholic closed 9 months ago

Askaholic commented 1 year ago

The default limit for StreamReader.readline is to stop after 64 KiB. It seems that this limit is sometimes being reached:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/streams.py", line 540, in readline
    line = await self.readuntil(sep)
  File "/usr/local/lib/python3.9/asyncio/streams.py", line 635, in readuntil
    raise exceptions.LimitOverrunError(
asyncio.exceptions.LimitOverrunError: Separator is found, but chunk is longer than limit

This probably never happened with the QDataStream protocol because it doesn't use readline, instead implementing the message deserialization in python using readexactly.

There are some messages that the client sends which can be pretty large, in particular the GameStats message contains a large JSON structure which can probably exceed the 64 KiB limit. We probably need to increase that limit to something much higher.

Askaholic commented 9 months ago

We don't seem to have encountered this error for quite some time now, so I'm closing this issue.