Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a2s protocol soft crashes when the server modlist is too long #12108

Closed
2 tasks done
UzricRash opened this issue Jun 1, 2023 · 2 comments
Closed
2 tasks done

a2s protocol soft crashes when the server modlist is too long #12108

UzricRash opened this issue Jun 1, 2023 · 2 comments
Assignees
Labels
Bug Something isn't working Code Programming task Networking Issue related to multiplayer or networking

Comments

@UzricRash
Copy link

Disclaimers

  • I have searched the issue tracker to check if the issue has already been reported.
  • My issue happened while using mods.

What happened?

When the modlist is too long, the a2s protocol stops working.
In consequence, anything that depends on it does not function. Namely: server discovery (the server no longer appears in the multiplayer server lobby and a direct connection is needed); and custom discord bots used in server monitoring.

The solution is as easy as limiting the number of the contentpackageNs or the size of the string within each contentpackageN in the rules dictionary of the a2s protocol handler.

Note that this bug probably existed since the handler's creation, and only as of the recent rework of the content package reporting has it become visible due to the added verbosity.

Note as well that this might be relevant to all the other values of the rules dictionary (see: message - that is the lobby description), but I have not tested it.

Reproduction steps

  1. Start a dedicated server. Might be relevant to p2p servers as well but I have not tested it so.
  2. Add 10-15 mods.
  3. The server disappears from the lobby.
    You can further prove this by using an a2s connection to the query port (default 27016), for example with python3 and the python-a2s library: if the petition is about a2s.info or a2s.players then the information is received. When the petition is about a2s.rules then the answer is dropped because the resulting packet is too big (exceeding 65536).

Bug prevalence

Happens regularly

Version

v1.0.13.2

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

No response

@NilanthAnimosus
Copy link
Collaborator

Tested against Release/traitor-update commit https://github.com/Regalis11/Barotrauma-development/commit/f433a8c6bf8727462e41eb7571d799a31d2398ba

This issue does still exist in the current latest code, Noting that I am not sure how many mods need to be added, but simply adding too many will cause a server to not correctly appear on the serverlist for queries (In my case I probably exceeded 50 mods, but it is indeed likely the amount and length of text of the mods combined exceeding some limit).

Quick notes:

  • Exceeding a text length of mods (Say, 20-50 mods) will cause servers to not appear in the list
  • Will not show even if hosted from the same machine via dedicated and public.
  • Server is still joinable, just does not appear in the serverlist.
  • Issue is likely related to SteamManager.cs lines 62-69 (Server project code) having no limit to the length/count of said contentpackage keys.

Tested with two servers, one with 4-8 mods and one with likely 30-60. same files, changed port (all forwarded) to confirm.

@NilanthAnimosus NilanthAnimosus added Bug Something isn't working Code Programming task Networking Issue related to multiplayer or networking labels Sep 25, 2023
@Regalis11
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Code Programming task Networking Issue related to multiplayer or networking
Projects
None yet
Development

No branches or pull requests

4 participants