garrysmod-issues
garrysmod-issues copied to clipboard
[Linux DS 64] file.AsyncRead isn't Async
Details
On Linux 64x file.AsyncRead doesn't seem to be Async.
My guess is that the filesystem's threadpool isn't started properly / same issue as https://github.com/Facepunch/garrysmod-issues/issues/5310 but I didn't verify this yet. https://github.com/perilouswithadollarsign/cstrike15_src/blob/master/filesystem/filesystem_async.cpp#L639
Steps to reproduce
- Start a Linux DS Server
- Run
lua_run local a=SysTime() for k=1, 50 do file.AsyncRead("steamclient.so", "BASE_PATH", function() end) end print(SysTime()-a) - Watch it freeze the main thread
Just verified it and it really seems like bEnableOnLinuxDedicatedServer is missing for the threadpool.
I have applied the proposed fix to the x86-64 beta.
Just tested it and it seems like it's still an active issue :/ What I literally do in holylib to fix it:
static bool hook_CThreadPool_Start(IThreadPool* pool, /*const*/ ThreadPoolStartParams_t& params, const char* pszName)
{
if (!params.bEnableOnLinuxDedicatedServer)
{
params.bEnableOnLinuxDedicatedServer = true;
if (g_pThreadPoolFixModule.InDebug())
Msg("holylib - threadpoolfix: Manually fixed threadpool! (%s)\n", pszName); // NOTE: The filesystem threadpool has no name?
}
return detour_CThreadPool_Start.GetTrampoline<Symbols::CThreadPool_Start>()(pool, params, pszName);
}
So it must be missing somewhere, but maybe it's in another place?
I think I used the wrong define for it, please test again.
tested it again and it works