Closed TeddiO closed 2 years ago
Additionally after some testing with a vanilla install of GMod, even calling something via an http based function in GM:Initialize()
is still too early 👀
To understand this issue better, is the server hang only happening with the module active? Is that example trace what seems to be causing the hang?
Also, can you make a small sample that reproduces the problem, so I can do it locally?
So it looks like the issue isn't to do with gm_luaerror
directly, but instead there's an infinite loop when trying to handle a specific scenario.
In this particular scenario the http.Fetch
(or any http*
based operation) function is what's actually failing which causes gm_luaerror
to attempt to handle the newly generated error, ad infinitum leading to an infinite loop.
Below is an example that should work if you dump it in to autorun/server
, but at this point it's not specifically a luaerror issue anymore.
require("luaerror")
luaerror.EnableCompiletimeDetour(true)
luaerror.EnableRuntimeDetour(true)
hook.Add("LuaError", "Example", function()
http.Fetch("https://google.com")
end)
error("This is an error")
Updated my previous comment with an updated example.
Having luaerror.EnableCompiletimeDetour
set to true
or luaerror.EnableRuntimeDetour
set to true will help facilitate an infinite loop if used in conjunction with a http
function and ISteamHTTP
is not yet available.
I've included an example in gamemode format as well if that's of better / more use to you.
I've replicated the problem and it's easy to fix. However, I'm undecided on whether to completely disallow reentrancy or allow a couple loops before stopping.
Please try this build (when it's done).
For some reason Windows keeps flagging it as a virus when the download completes (gmsv_luaerror_win32.dll
)
Tried it on my Windows Defender and it didn't report anything, although VirusTotal reports the same as you. https://www.virustotal.com/gui/file/dcac940d3f6c1bed2e8ca0ee5237943f56c0fec62acb48f4a407a996ae1ffd15
Not much I can do, I'm afraid. Detouring and signature scanning seems like relative common things for viruses.
That's fair, I'll just tell Windows to ignore it, can't help false positives!
Yep, that works! 🎉
Just to put it out there, I went with the no reentrancy route, which means you won't receive LuaError
hook calls for errors that occurred inside a LuaError
.
If an error is thrown before
ISteamHTTP
is available (e.g. close to or on server boot), the server will hang and endlessly consume RAM until the server echosnot enough memory
.Example error trace: