garrysmod-issues
garrysmod-issues copied to clipboard
Screen freezing randomly leaving audio only running + Thread
Yes I know this issue already exists currently (aka #2091) though I also want to make this a thread for anyone else who has been dealing with this issue for a long time now and possible solutions that can fix the issue. If this isn't an appropriate place to put this at then I will move this to the Facepunch forums.
Issue
There is many moments when your playing hours into a server and just randomly, the game screen freezes which means you have to close the game and lose all of your progress. I searched up many ways to see how to fix this issue and the only suggestion is to (e.g. close out of the game, restart your PC, close many programs, set the program as high priority) though sometimes those solutions do work and sometimes they don't work but they all only fix the problem temporarily.
I'm not sure if this ever will be fixed for Garry's Mod though seriously this bug has pestered me and a lot of other players for the last few years of playing this game.
So I'm suggesting a fix where when the screen freezes, the graphics restarts for the game so that players can keep playing the game without having to reboot it and lose a lot of progress. If anyone else has other solutions than the ones mentioned below to fix this issue, please leave a comment down below so I can possibly add it to the list below.
Known Solutions (Windows)
WARNING! Some of these solutions posted can cause crashes to your system causing you to lose data. I do NOT claim any responsibility for any damages and/or injuries for any of the solutions posted on here. You have been warned.
Note that all of these solutions are mostly temporary and are not permanent fixes to the issue.
Resetting the window size
The method that mostly works so far is this:
bind home "mat_antialias 0"
bind end "mat_antialias 1"
Paste both of those commands into the console. You have to bind two of them like the example because the game will only reset your graphics state if the value is different from before. For some odd reason, mat_antialias
will trigger a screen resolution reset restoring the graphics state from what I understand.
Setting Garry's Mod as High Priority
This will cause Garry's Mod to have more focus on resources usage from the operating system instead of it taking up the resources the game needs. Personally this has fixed the issue sometimes though has a chance of force restarting the PC.
Steps:
- Open up Garry's Mod.
- Search > Task Manager > More Details (If the window is small) > Details > hl2.exe > Right Click > Set Priority > Click on High.
- You will get a prompt asking if you want to change the priority though has a chance of causing system instability.
Closing down background programs
Some programs uses heavy processing power to render (aka Chrome, Firefox, Discord, Steam, Painting or Rendering Programs [e.g. Blender, Paint.net, GIMP, Krita]) which will leave few graphical resources for Garry's Mod to use which will cause the freezing issue to happen. It's best to close down programs your currently not using so Garry's Mod can have more graphical resources to use. Though for me personally testing this, this rarely sometimes has a chance of not working.
Restarting your PC
There is a possibility that there is allocated resources in your system that has not been cleaned up which still leaves scarce resources for Garry's Mod to use. Restarting your PC can possibly clean up the memory usage that is normally not possible from shutting down programs.
Lowering down graphics
From the other thread (aka #2091), some people have reported that lowering down some of the graphics qualities can free up video usage and cause the freezes to occur less often.
Steps:
- Open up Garry's Mod.
- Click on Settings.
- Click on the Video tab.
- Click on Advanced Settings.
- Choose the lowest graphics choice for any of the settings.
Removing addons
Some addons that you possibly have installed right now on your Garry's Mod (e.g. mostly enhanced texture, models, and overall graphics addons) can be a cause to the issue. You can fix it by disabling some or all of your addons to see if it improves the issue.
Problems with addons/gamemodes using too much graphical calls
From the other thread (aka #2091), @robotboy655 has noted that running surface.createFont
around a thousand times can cause the game to allocate too many graphical resources causing the game to freeze. This raises a point where any addons/gamemodes can possibly be making too many calls to some internal graphical functions on the client side causing the game to freeze. Only solution to this is to ask the addon/gamemode creator to either optimize or fix these issues on their side.
Shutting down the PC around two times
Oddly enough in Windows, by shutting down your PC (and not restarting it), Windows will clear certain memory that is other wise cannot be cleared on restart (Unless you configure it on your PC, which I forgot how to do it [Though it might have to do something with Swap memory]).
These are the known solutions that I know so far. If you have any suggestions/solutions, please leave a comment down below, and thanks for reading!
Strangely enough I got some performance screenshots here from when the game froze but didn't entirely permanently freeze. What was strange was that when I look at task manager and click back on the game again, the game permanently froze then. When the crash spike happened. 3D went to a 100% usage, Copy (which is almost never used), went up to around 5%, Dedicated GPU Memory dropped then went back to normal again, and a slight usage in shared GPU memory.
I have a slight idea that another cause of this could be swap usage. Though checking the usage status in permon.exe, there was 0% usage in the Page File entirely.
I remember that restarting my PC/shutting it down two times instead of one always fixed the issue. I'm not sure exactly why or how that fixes the entire issue though Windows is probably clearing something that allows Garry's Mod to work again. I'm not sure if it will work again.
I'm running net_graph 2 and oddly enough I can't get the game to crash this time.
I got a screen freeze with net_graph and net graph didn't spike up at all. What's strange is that this problem only occurs randomly though it seems to occur frequently overtime. If I completely reset Garry's Mod at this point, I would guess the issue would be fixed temporarily but it would occur again overtime.
I shut down my PC (Not restarting it, actually just shutting it down) two times and then ran Garry's Mod. This actually solves the issue for some odd reason for me for a very long time (aka a few days or even weeks). I remembered Windows only cleans certain part memory upon shutdown and not restart. Of course this might not be a solution that works for everyone else.
I also noticed that when Windows shuts down by default, it doesn't really shut down but saves a kind of system snapshot in memory and goes into a prolonged hibernation. At launch, it just restores the image to speed up the startup. It's possible to disable this effect to really shut down the computer, this may explain the problem (?).
Source: https://www.windowscentral.com/how-disable-windows-10-fast-startup
If this is one of the parts of the problem, then I'm not sure what Garry's Mod or Source Engine is exactly doing to make this a problem. When this problem occurs with Garry's Mod, any other program, game, or software like Blender runs just fine, even when they are rendering at the highest settings.
I'd like to say it's because the Source 1 engine is old and obsolete but that's far too easy. Personally, I experienced a few years ago the problems you are experiencing now. In 2015/2016 and when I was playing for a long time on a server (several hours), I sometimes had freezes for no reason. A simple restart was enough but over the years it has stabilized and I don't really experience this problem anymore unless the server I play on is completely overloaded with addons like most DarkRP and its derivatives (even on the 64-bit branch).
However, the problem is not completely solved, I would say that the performance of the game in general degrades over time. The longer you play on a server without stopping, the more you'll see a feeling of having had a drop in FPS compared to the beginning, I don't really have any proof of this but I have a lot of players who have reported the same thing, especially on roleplay servers like HL2RP. Since this kind of gamemodes like Helix, Clockwork, etc.. ask the players to be less nervous, it's easier to feel the lags of the servers whereas on DarkRP servers, it's almost normal to not have a constant number of FPS, to have some lags because there are 30 cars out at the same time, etc.. and in general, on very long play sessions, I was often told that the number of FPS had dropped, even if there was no increase in players, spawn of props/NPCs, etc..
I also noticed that when Windows shuts down by default, it doesn't really shut down but saves a kind of system snapshot in memory and goes into a prolonged hibernation. At launch, it just restores the image to speed up the startup. It's possible to disable this effect to really shut down the computer, this may explain the problem (?).
Source: https://www.windowscentral.com/how-disable-windows-10-fast-startup
I never knew that Windows implemented something like that not long ago? I'm not sure however if this is the cause of this because Restart isn't affected by Fast Startup. Though it possibly still has something to do with how restarting is still saving some memory and shutdown (around 2 times I assume) wipes that memory.
I never knew that Windows implemented something like that not long ago?
After some research, it seems that the feature was already present on Windows 8 in 2016 and then was reimplemented in 2019 on Windows 10... but we drift from the initial subject.
https://github.com/Facepunch/garrysmod-requests/issues/435 Textures created by Lua cannot be disposed. This potentially(? #5011) includes Awesomium/CEF textures from DHTML controls.
I was often told that the number of FPS had dropped, even if there was no increase in players, spawn of props/NPCs, etc..
The more hours you spend on a server, the more orphaned textures will accumulate. The number of orphaned Lua functions from bad addons that are still drawing with those unfreed textures will also accumulate. This also supports the theory of running out of usable VRAM causing the game-still-running-but-frozen-screen issue.
A combination of 1) rubat implementing request 435 and 2) people making less-shitty addons would help this issue a lot.
I been trying out some more options lately to mitigate the issue and to try to see if any of the options could restart the graphics when it freezes.
I could of sworn I remember back then when the game freezes, the game actually recovered but this was on an older PC.
I figured out how to fix it. When your game freezes you need to use a command that will restart the graphics. Here I bind two commands:
bind home "mat_antialias 1"
bind end "mat_antialias 0"
Paste both of those commands into the console. You have to bind two of them like the example because the game will only reset your graphics state if the value is different from before. For some odd reason, mat_antialias
will trigger a screen resolution reset restoring the graphics state from what I understand.
i know this isssue that because u download too much addon remove some of them that u dont use
Mat_antialias trick no workie It just shows your desktop while the issue persists