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

Properly handle invalid cvar replications without blocking netmessage #408

Merged
merged 15 commits into from
Jul 4, 2024

Conversation

BobTheBob9
Copy link
Member

@BobTheBob9 BobTheBob9 commented Jan 29, 2023

Reimplements ns_server_name and ns_server_desc replication without causing issues on clients that do not have the change locally, and prevents bad replicated cvars from breaking client connect

entirely and restore ns_server_name replication
Copy link
Member

@GeckoEidechse GeckoEidechse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't work in testing.

In particular, with this PR I could join a random just fine but hosting a (Windows) dedi an having someone on v1.12.0 join did not work. They got stuck in loading screen with no error message or anything in logs.

To reproduce:

  1. Host dedi with this PR
  2. Have someone on v1.12.0 join said dedi server
  3. They should now be stuck in eternal loading screen.

EDIT: Relevant sections from log from client that couldn't join. They had to kill Northstar via taskmanager

[23:32:36] [NORTHSTAR] [info] Requesting server list from https://northstar.tf
[23:32:36] [NORTHSTAR] [info] Got 144 servers
[23:32:38] [NORTHSTAR] [info] Attempting to register the local server to the master server.
[23:32:41] [SCRIPT UI] [info] trying to authenticate with server Temp Testing server with password 
[23:32:42] [NORTHSTAR] [info] Attempting authentication with server of id "d1af1dec8e680450ced0c08edf6f9782"
[23:32:42] [SCRIPT UI] [info] Showing user info for UID 0 on hardware 
[23:32:42] [SCRIPT UI] [info] Showing user info for UID 0 on hardware 
[23:32:42] [SCRIPT UI] [info] Showing user info for UID 0 on hardware 
[23:32:42] [SCRIPT UI] [info] UICodeCallback_LevelShutdown: mp_lobby
[23:32:42] [SCRIPT UI] [info] Hiding all matchmaking elems due to UpdateMatchmakingStatus thread ending
[23:32:42] [SCRIPT UI] [info] menu_ServerBrowserMenu menu closed
[23:32:42] [SCRIPT UI] [info] menu_LobbyMenu menu closed
[23:32:42] [SCRIPT UI] [info] menu_MainMenu menu opened
[23:32:42] [SCRIPT UI] [info] =========== Show: MainMenuPanel ===========
[23:32:42] [SCRIPT UI] [info] SAVEGAME try is valid savegame
[23:32:42] [SCRIPT UI] [info] SAVEGAME is valid  savegame
[23:32:42] [NORTHSTAR] [info] DestroyVM CLIENT 0x2035401e400
[23:32:42] [SCRIPT UI] [info] UICodeCallback_LevelLoadingStarted: 
[23:32:42] [NORTHSTAR] [info] HostState: GameShutdown
[23:32:42] [NORTHSTAR] [info] Player eRaid_oPlaiN disconnected: "Game Shutting Down"
[23:32:42] [NORTHSTAR] [info] Player eRaid_oPlaiN disconnected: "Game Shutting Down"
[23:32:42] [NORTHSTAR] [warning] attempted to write pdata of size 0!
[23:32:42] [NATIVE SV] [info] CVScriptGameSystem::LevelShutdownPreEntity()
[23:32:42] [NORTHSTAR] [info] DestroyVM SERVER 0x2034a3d4600
[23:32:43] [RPAK_FSYS] [info] LoadPakAsync mp_forwardbase_kodai_loadscreen.rpak 209
[23:32:43] [RPAK_FSYS] [info] LoadStreamPak: pc_all.starpak
[23:32:43] [SCRIPT UI] [info] UICodeCallback_UpdateLoadingLevelName: mp_forwardbase_kodai
[23:32:43] [FILESYSTM] [info] MountVPK vpk/client_mp_forwardbase_kodai.bsp
[23:32:43] [NORTHSTAR] [info] Set playlist to tdm
[23:32:43] [NORTHSTAR] [info] 
R2
Map: mp_forwardbase_kodai
Players: 2 (0 bots) / 16 humans
Build: 6968
Server Number: 2

[23:32:43] [SCRIPT UI] [info] UICodeCallback_UpdateLoadingLevelName: mp_forwardbase_kodai
[23:32:43] [RPAK_FSYS] [info] LoadPakAsync mp_forwardbase_kodai.rpak 210
[23:32:43] [RPAK_FSYS] [info] LoadStreamPak: pc_all.starpak
[23:32:43] [RPAK_FSYS] [info] LoadStreamPak: pc_all(04).starpak
[23:32:43] [RPAK_FSYS] [info] LoadStreamPak: pc_all(06).starpak
[23:32:47] [NORTHSTAR] [error] ExploitFixes.cpp: NET_SetConVar (client): Blocked dangerous/invalid msg: Invalid flags (0x4), var is ns_server_desc
[23:32:48] [NORTHSTAR] [error] Failed reading masterserver response: got fastify error response
[23:32:48] [NORTHSTAR] [error] {"error":{"enum":"NO_GAMESERVER_RESPONSE","msg":"Couldn't reach game server: failed to connect to auth port: request timed out"},"request_id":"cfdeh193ngoqhtcdte2g","success":false}

[23:33:55] [NORTHSTAR] [info] HostState: GameShutdown
[23:33:55] [NORTHSTAR] [warning] ServerAuthenticationManager::StopPlayerAuthServer was called while m_bRunningPlayerAuthThread is false
[23:33:55] [NATIVE SV] [info] CVScriptGameSystem::LevelShutdownPreEntity()
[23:33:55] [NORTHSTAR] [info] Set playlist to tdm
[23:33:55] [SCRIPT UI] [info] UICodeCallback_LevelLoadingFinished:  (false)
[23:33:55] [SCRIPT UI] [info] UICodeCallback_ActivateMenus: menu_MainMenu
[23:33:55] [SCRIPT UI] [info] UICodeCallback_ActivateMenus: menu_MainMenu
[23:33:55] [NORTHSTAR] [info] DestroyVM UI 0x2034abc0300

Also, going back to v1.12.0 on dedi and retrying client joining worked just fine so issue seems to be with PR.

@BobTheBob9
Copy link
Member Author

re-requesting review as previous testing didn't properly test pr

@GeckoEidechse
Copy link
Member

Will take another look once I'm back in a few days. If anyone else is able to do it earlier, feel free to do so and leave a review. ^^

Either way with this merged we'd probably have to version gate again to prevent breakage. so not sure when the best time to merge/release it is.

@GeckoEidechse
Copy link
Member

(closing was miss-click, sorry >.<)

@BobTheBob9 BobTheBob9 requested a review from a team February 14, 2023 13:41
@GeckoEidechse
Copy link
Member

GeckoEidechse commented Feb 18, 2023

Uh what was the best way to test this again? ^^"

Given that it breaks compat with older clients?

EDIT:

New convar (or mod existing) on both client and server
SERVERSIDE: convar exists on both client and server, client it is userinfo, server it is not
CLIENTSIDE: convar exists on both, server it is replicated, client it is not

@pg9182 pg9182 added the needs testing Changes from the PR still need to be tested label Apr 18, 2023
Copy link
Contributor

@ASpoonPlaysGames ASpoonPlaysGames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, Gecko's testing should still also be valid I think?

@Alystrasz
Copy link
Contributor

Dunno if this can be merged, but it can't be updated to main because of branch protection rules.

@GeckoEidechse
Copy link
Member

Dunno if this can be merged, but it can't be updated to main because of branch protection rules.

Thanks for the heads-up. I got enough perms so I updated it now ^^

@GeckoEidechse
Copy link
Member

Also sorta issue with this PR is that it's incompatible with previous versions so it requires a version gate.

@GeckoEidechse GeckoEidechse added the breaking change This PR introduces a breaking change that will require a version gate label Oct 10, 2023
@github-actions github-actions bot added the merge conflicts Blocked by merge conflicts, waiting on the author to resolve label Dec 20, 2023
Resolves the merge conflicts for #408
@github-actions github-actions bot removed the merge conflicts Blocked by merge conflicts, waiting on the author to resolve label Mar 12, 2024
GeckoEidechse and others added 2 commits March 14, 2024 10:03
I reverted things in #680 accidently when resolving conflicts so this is here to fix it
Got accidentally introduced in #681
Copy link
Member

@catornot catornot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was running this branch with a friend for a week or so with no issues :)

hopefully this will get merged soon.

@GeckoEidechse GeckoEidechse removed the needs testing Changes from the PR still need to be tested label Mar 29, 2024
@GeckoEidechse GeckoEidechse changed the title properly handle invalid cvar replications without blocking netmessage Properly handle invalid cvar replications without blocking netmessage Mar 29, 2024
@GeckoEidechse GeckoEidechse mentioned this pull request Apr 2, 2024
Copy link
Member

@GeckoEidechse GeckoEidechse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested rn and no breaking change to older servers which is awesome :D
No clue why it broke when I tested before.

Code review was done by others earlier before already.

@GeckoEidechse GeckoEidechse merged commit 193ab49 into main Jul 4, 2024
8 checks passed
@GeckoEidechse GeckoEidechse deleted the fix-invalid-cvar-replication3 branch July 4, 2024 20:53
wolf109909 pushed a commit to R2NorthstarCN/NorthstarLauncher that referenced this pull request Oct 21, 2024
…R2Northstar#408)

Properly handle invalid cvar replications without blocking netmessage entirely and restore `ns_server_name` replication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This PR introduces a breaking change that will require a version gate
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants