Client applications randomly closing out

I’ve recently encountered a very frustrating issue that is occurring frequently on my server.
Randomly some clients have their application closed out, without a error message or anything its as if you were to press the close button on the application.
I’ve noticed that it occurs when you attempt to join the server, or when someone disconnects. Not everyone is effected and the message when they close out is they “timed out”.
Now I’ve coded all the addons I use on my servers, so if anything do you guys know a lua method or some type of bad function usage that would cause something like this.
Very much help is appreciated.

I already have VAC disabled on my server

Are you using TDMCars?

I was able to have Garry’s Mod crash reliably for me, the game would just close using this code when I derped and called it wrong - one of those long nights no sleep due to my car accident injury:

http://forum.facepunch.com/showthread.php?t=1288912

[lua]function PANEL:Think( )
// This code crashes Garry’s Mod when uncommented; CTD
if ( input.IsKeyDown( IN_SCORE ) ) then
self:Remove( )
end
end[/lua]

Another way I was able to cause Garry’s Mod to crash, was by replacing textures when the player fully connects to the server ( Someone on a mac had this issue ). I found that by wrapping it in a 5 second simple timer the issue was resolved for the mac user.

Those are things I’ve experienced to cause a straight CTD with no warning. I’m sure there are probably more but it’d be a place to start looking.

I checked both of those, and i’m not doing any of those two.
Thanks alot though, i’ll commit a issue on git hub.

No, I am not.

here is a example: someone disconnected and we lost 15+ players.

http://puu.sh/3GNFw.jpg

http://puu.sh/3GNEt.png

After lots of time uninstalling and constantly checking if clients were timing out i’ve figured out the issue.

I was removing userdata inside a PreDrawOpaqueRenderables hook

[lua]
hook.Add(“PreDrawOpaqueRenderables”, “DrawCModel”, function()
for idx, data in pairs( CModels ) do
local ply = Entity( idx )

	if ( !IsValid( ply ) ) then KillCModel( idx ) continue end
    end

end)

local function KillCModel( idx )
for _, data in pairs( CModels[ idx ] ) do
for _, models in pairs( data ) do
models:Remove()
end
end

CModels[ idx ] = nil

end
[/lua]