Closed ThenTech closed 11 months ago
Even though I did set the Lock pages in memory
security setting, I didn't actually test running as admin.
That gives a more extensive error message:
0.766 Error CrashHandler.cpp:621: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-build-eisait\libraries\stackwalker\stackwalker.cpp (924): StackWalker::ShowCallstack
c:\cygwin64\tmp\factorio-build-eisait\src\util\logger.cpp (541): Logger::writeStacktrace
c:\cygwin64\tmp\factorio-build-eisait\src\util\logger.cpp (548): Logger::logStacktrace
c:\cygwin64\tmp\factorio-build-eisait\src\util\crashhandler.cpp (184): CrashHandler::writeStackTrace
c:\cygwin64\tmp\factorio-build-eisait\src\util\crashhandler.cpp (630): CrashHandler::SignalHandler
minkernel\crts\ucrt\src\appcrt\misc\exception_filter.cpp (219): _seh_filter_exe
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (304): `__scrt_common_main_seh'::`1'::filt$0
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF79C5795F8)
00007FF79C5795F8 (Factorio): (filename not available): __C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFFCE2B23AF)
00007FFFCE2B23AF (ntdll): (filename not available): _chkstk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFFCE2614B4)
00007FFFCE2614B4 (ntdll): (filename not available): RtlRaiseException
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFFCE2B0EBE)
00007FFFCE2B0EBE (ntdll): (filename not available): KiUserExceptionDispatcher
C:\Users\Lukas\source\repos\mimalloc\src\alloc.c (979): mi_new
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\xstring (2131): std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\vector (961): std::vector<std::filesystem::_Path_iterator<std::_String_const_iterator<std::_String_val<std::_Simple_types<wchar_t> > > >,std::allocator<std::filesystem::_Path_iterator<std::_String_const_iterator<std::_String_val<std::_Simple_types<wchar_t> > > > > >::_Emplace_reallocate<std::filesystem::_Path_iterator<std::_String_const_iterator<std::_String_val<std::_Simple_types<wchar_t> > > > &>
c:\cygwin64\tmp\factorio-build-eisait\src\filesystem\sortedpath.cpp (73): SortedPath::getSortData
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\xtree (2050): std::_Tree<std::_Tmap_traits<SortedPath,ZipPackage::PathData,std::less<SortedPath>,std::allocator<std::pair<SortedPath const ,ZipPackage::PathData> >,0> >::_Lbound<SortedPath>
c:\cygwin64\tmp\factorio-build-eisait\src\package\zippackage.cpp (50): ZipPackage::fillLibrary
c:\cygwin64\tmp\factorio-build-eisait\src\package\package.cpp (28): Package::openPackage
c:\cygwin64\tmp\factorio-build-eisait\src\data\modmanager.cpp (906): ModManager::createMod
c:\cygwin64\tmp\factorio-build-eisait\src\data\modmanager.cpp (200): ModManager::loadMods
c:\cygwin64\tmp\factorio-build-eisait\src\data\modmanager.cpp (322): ModManager::loadData
c:\cygwin64\tmp\factorio-build-eisait\src\globalcontext.cpp (504): GlobalContext::init
c:\cygwin64\tmp\factorio-build-eisait\src\mainloop.cpp (272): MainLoop::run
c:\cygwin64\tmp\factorio-build-eisait\src\main.cpp (1123): wmain
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (288): __scrt_common_main_seh
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFFCD717344)
00007FFFCD717344 (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFFCE2626B1)
00007FFFCE2626B1 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
2.756 C:\Apps\Factorio\bin\x64\Factorio.exe
2.756 C:\WINDOWS\SYSTEM32\ntdll.dll
2.756 C:\WINDOWS\System32\KERNEL32.DLL
2.756 C:\WINDOWS\System32\KERNELBASE.dll
2.756 C:\WINDOWS\System32\WLDAP32.dll
2.756 C:\WINDOWS\System32\ucrtbase.dll
2.756 C:\WINDOWS\System32\GDI32.dll
2.756 C:\WINDOWS\System32\win32u.dll
2.756 C:\WINDOWS\System32\gdi32full.dll
2.756 C:\WINDOWS\System32\msvcp_win.dll
2.756 C:\WINDOWS\System32\USER32.dll
2.756 C:\WINDOWS\System32\ole32.dll
2.756 C:\WINDOWS\System32\RPCRT4.dll
2.756 C:\WINDOWS\System32\combase.dll
2.756 C:\WINDOWS\System32\PSAPI.DLL
2.756 C:\WINDOWS\System32\SHELL32.dll
2.756 C:\WINDOWS\System32\SHLWAPI.dll
2.756 C:\WINDOWS\System32\msvcrt.dll
2.756 C:\WINDOWS\System32\IMM32.dll
2.756 C:\WINDOWS\System32\OLEAUT32.dll
2.756 C:\WINDOWS\System32\ADVAPI32.dll
2.756 C:\WINDOWS\System32\sechost.dll
2.756 C:\WINDOWS\System32\WS2_32.dll
2.756 C:\WINDOWS\System32\CRYPT32.dll
2.756 C:\WINDOWS\System32\WINTRUST.dll
2.756 C:\WINDOWS\System32\imagehlp.dll
2.756 C:\WINDOWS\SYSTEM32\WINMM.dll
2.756 C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.3636_none_91a19322cc8a92a3\gdiplus.dll
2.756 C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL
2.756 C:\WINDOWS\SYSTEM32\VERSION.dll
2.756 C:\WINDOWS\SYSTEM32\DSOUND.dll
2.756 C:\WINDOWS\SYSTEM32\powrprof.dll
2.756 C:\WINDOWS\SYSTEM32\winmmbase.dll
2.756 C:\WINDOWS\SYSTEM32\UMPDC.dll
2.756 C:\WINDOWS\SYSTEM32\MSASN1.dll
2.756 Error CrashHandler.cpp:480: Exception Code: c0000005, Address: 0x00007fff89a33cfb
ModuleBase: 0x00007ff79b350000, ImageSize: 01c0b000, RelativeAddress: ee6e3cfb
So the crashes seems to be caused by calling std::vector<wchar_t>::_Emplace_reallocate
.
My best guess is that it's not compatible with Factorio 1.0 for some reason, it works fine for me on 1.1.94. Maybe the byte signatures I use to patch malloc don't work in 1.0, either they match and patch something they shoudn't or one of the malloc functions that has to be patched is diffrent and dosn't get patched.
I'm probably not going to fix it if it's a 1.0.x (or older) only problems, it would be a whole lot of work to figure out working signatures for that version, and then I'd have to find a way to configure which ones to use.
Does it work for you on the latest Factorio version?
Good to know.
I haven't tested it for the latest version, since the save file on 1.0 is using mods that are now incompatible with 1.1. And that's the only save file I have currently that suffers from UPS drain.
But I'll see if I can find a benchmark save file for 1.1.x and test it again to see the impact of mimalloc. I'll report back.
I ran it successfully with version 1.1.94 and tried with this map: https://factoriobox.1au.us/map/info/4c5f65003d84370f16d6950f639be1d6f92984f24c0240de6335d3e161705504
This was the initial fresh run for reference with 137 UPS.
I ran the following Factorio --benchmark s with Injector, running for 1000 ticks for 5 runs: |
Env vars | UPS |
---|---|---|
RESERVE_HUGE_OS_PAGES=4 PURGE_DELAY=1000 EAGER_COMMIT=1 Injector.exe --benchmark ... |
118 | |
RESERVE_HUGE_OS_PAGES=1 PURGE_DELAY=100 EAGER_COMMIT=1 Injector.exe --benchmark ... |
116 | |
Without injector | 114 |
(removed MIMALLOC_
etc. for brevity)
So the actual improvement using large memory pages and mimalloc, are marginal at best if anything.
The actually performance differences can vary greatly based on hardware and other factors. On stellaris somone reported getting 10-15% with Large Pages whiles reporting that his friend got 80%, so gains just aren't consistant. In general the performance increase is lower on better cpus, especially on X3D cpus. First is large pages actually working for you? It won't work if you A: Don't have the permssion set B: Didn't reboot after setting the permissions C: Don't have have large enough continues area in ram to allocate large/huge pages, on 16GB of ram it often won't actually use huge pages if I ever had chrome open and closing everyhting is not enough to fix it. For me on my surface with 16GB of RAM I can only get it to work by rebooting then launching the game without running anything big beforehand.
You can use RamMap while and see if any large pages are actually allocated.
Anyway since this issue only applies to 1.0.0 I'll mark this on won't fix and close the issue.
After seeing this on Reddit, decided to try it out on my 10kspm base in Factorio v1.0.0 to see how much, if any, UPS could be recovered.
After launching the Injector with the
MIMALLOC
environment variables (or without) and it successfully injecting (after beep), Factorio launches, but briefly pauses onLoading mods...
after which it crashes with the following message in the log:This also happens with an empty mod folder, so presumably already when trying to load the base mod.
Other system info:
I thought I'd let you know.