ValveSoftware / halflife

Half-Life 1 engine based games

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when changing renderer after starting multiplayer server

SamVanheer opened this issue · comments

If you start a multiplayer server and then change the renderer the game crashes.

This is probably the same bug as what was reported here: https://steamcommunity.com/groups/SteamClientBeta/discussions/0/3823034248729698719/

Copying the contents here:

If a game is soft restarted (game shuts itself down and restarts without ending the process itself) after having started a multiplayer server then a deadlock will occur in steamclient.dll.

This is known to occur in Half-Life 1. It seems to be a new bug because i have never encountered it before but i don't know how long ago it actually started happening. I first encountered it a week or two ago.

Operating System: Windows 10 version 21H2

Steps to reproduce:

  1. Start Half-Life 1
  2. Launch a multiplayer server (in the console: maxplayers 32; map crossfire)
  3. Soft restart the game. The easiest way to do this is to enter the _restart command in the console, but changing game resolution or windowed mode will also do this
  4. Launch a multiplayer server again. The game will freeze during loading

The cause seems to be a deadlock in steamclient.dll that occurs when the game tries to create a Steam game server. See this call stack captured using Visual Studio:

>	ntdll.dll!_NtWaitForSingleObject@12�()	Unknown
 	KernelBase.dll!WaitForSingleObjectEx()	Unknown
 	KernelBase.dll!_WaitForSingleObject@8�()	Unknown
 	tier0_s.dll!CThreadFullMutex::TryLock() + 50 bytes	Unknown
 	[Frames below may be incorrect and/or missing, no symbols loaded for tier0_s.dll]	
 	steamclient.dll!0584e2ee()	Unknown
 	steamclient.dll!05803295()	Unknown
 	steamclient.dll!057e9178()	Unknown
 	ntdll.dll!_NtWaitForSingleObject@12�()	Unknown
 	KernelBase.dll!WaitForSingleObjectEx()	Unknown
 	steamclient.dll!057f2074()	Unknown
 	steamclient.dll!0584e266()	Unknown
 	steamclient.dll!05b759e8()	Unknown
 	steamclient.dll!05859099()	Unknown
 	steamclient.dll!05858e7d()	Unknown
 	steam_api.dll!SteamGameServer_GetHSteamUser() + 92 bytes	Unknown
 	steam_api.dll!SteamGameServer_Init() + 34 bytes	Unknown
 	hw.dll!100c4717()	Unknown

This is the main process thread's call stack.

Other threads are all stuck waiting as well because of this so the entire game is frozen.

It's worth noting that Half-Life 1 and Steam both have a tier0 dll so it's possible that they are unintentionally sharing state, but i think it's more likely to be incorrect clearing of state when the game calls SteamAPI_Shutdown().


New information about the current behavior:

Operating system: Windows 11 Home build 22631

Exception message:

Exception thrown at 0x00000002 in hl.exe: 0xC0000005: Access violation executing location 0x00000002.

Call stack:

>	00000002()	Unknown
 	[Frames below may be incorrect and/or missing]	Unknown
 	steamclient.dll!62c5fe94()	Unknown
 	steamclient.dll!62c65bf8()	Unknown
 	hw.dll!03418d2b()	Unknown
 	hw.dll!033dff17()	Unknown
 	hw.dll!033d3207()	Unknown
 	hw.dll!03420c32()	Unknown
 	hw.dll!03421198()	Unknown
 	hw.dll!03420727()	Unknown
 	hw.dll!034200c8()	Unknown
 	hl.exe!00b7159c()	Unknown
 	ntdll.dll!_NtQueryVirtualMemory@24�()	Unknown
 	KernelBase.dll!VirtualQueryEx()	Unknown
 	kernel32.dll!@BaseThreadInitThunk@12�()	Unknown

This is probably a bug in the Steam client rather than Half-Life but the report was probably lost in the soup that is the Steam beta forums and it's one of relatively few games that behaves this way so it's worth tracking here.

Today's update fixes this bug. Changing the renderer while in a local multiplayer server no longer crashes the game. More generally, using the _restart command on its own doesn't cause any crashes in that situation either.

Closing per "Fixed crash when modifying certain video settings in a multiplayer match." in the 2023-12-01 Half-Life update.