Page 1 of 1

[boskid][2.0.27] Full Crash on Load of Save (EnemySpawner::findUnitToSendToAttack)

Posted: Fri Dec 20, 2024 11:35 am
by BigDaveNz
This is a heavily modded game, updated to latest and this crash occured. I wouldn't be suprised if the cause was a mod (Possibly ERM), however I wouldnt expect the game to crash in this way with a full game exit. I've attached the full log and save if you need it.

Specific Reproduction was.

1. Upgraded from 2.0.25
2. Upgraded all mods to the latest versions (There were ~20 with patches)
3. Pressed Continue in the main menu.
4. Crash happens almost immediately as the game loads

Note: I attempted to load previous autosaves to see if it was a specific timing, but it exhibited the same behaviour.

Code: Select all

1049.315 Script @__stdlib2__/stdlib/area/position.lua:589: WARNING: Area for Position not found in package.loaded
1049.318 Crashed in C:\Program Files (x86)\Steam\steamapps\common\Factorio\bin\x64\Factorio.exe (0x00007ff7e4df0000 - 0x00007ff7e7680000)
Factorio crashed. Generating symbolized stacktrace, please wait ...
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\libraries\StackWalker\StackWalker.cpp(924): StackWalker::ShowCallstack
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Util\Logger.cpp(337): Logger::writeStacktrace
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Util\Logger.cpp(379): Logger::logStacktrace
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Util\CrashHandler.cpp(183): CrashHandler::writeStackTrace
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Util\CrashHandler.cpp(552): CrashHandler::SehHandler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFDCD51CA1C)
00007FFDCD51CA1C (KERNELBASE): (filename not available): UnhandledExceptionFilter
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFDCFBD9ABD)
00007FFDCFBD9ABD (ntdll): (filename not available): memcpy
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFDCFBBF7C7)
00007FFDCFBBF7C7 (ntdll): (filename not available): _C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFDCFBD543F)
00007FFDCFBD543F (ntdll): (filename not available): _chkstk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFDCFB4E886)
00007FFDCFB4E886 (ntdll): (filename not available): RtlFindCharInUnicodeString
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFDCFBD443E)
00007FFDCFBD443E (ntdll): (filename not available): KiUserExceptionDispatcher
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Entity\EnemySpawner.cpp(331): EnemySpawner::findUnitToSendToAttack
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Entity\EnemySpawner.cpp(200): EnemySpawner::handlePollution
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Entity\EnemySpawner.cpp(161): EnemySpawner::update
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Surface\Chunk.cpp(432): Chunk::updateActiveEntities
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Surface\Chunk.cpp(486): Chunk::updateEntities
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Surface\Surface.cpp(2460): Surface::update
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Map\Map.cpp(1273): Map::updateEntities
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Game.cpp(175): Game::update
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Scenario\Scenario.cpp(1160): Scenario::updateStep
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\MainLoop.cpp(1403): MainLoop::gameUpdateStep
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\MainLoop.cpp(1212): MainLoop::gameUpdateLoop
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\functional(823): std::_Func_impl_no_alloc<`MainLoop::mainLoopStep'::`2'::<lambda_1>,void>::_Do_call
C:\Users\build\AppData\Local\Temp\factorio-build-d8lqk4\src\Util\WorkerThread.cpp(71): WorkerThread::loop
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\thread(56): std::thread::_Invoke<std::tuple<void (__cdecl TransferSource::*)(void),TransferSource *>,0,1>
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp(97): thread_start<unsigned int (__cdecl*)(void *),1>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFDCF4D259D)
00007FFDCF4D259D (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFDCFB8AF38)
00007FFDCFB8AF38 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
1050.299 Error CrashHandler.cpp:190: Map tick at moment of crash: 3100860
1050.340 Info CrashHandler.cpp:318: Executable CRC: 4125311380
1050.340 Error Util.cpp:95: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
1058.474 Uploading log file
1058.492 Error CrashHandler.cpp:270: Heap validation: success.
1058.493 Creating crash dump.
1058.629 CrashDump success

This is the first full crash of Factorio I've seen in nearly 4K hours of playtime, so i consider this an achievement! Thank you for all your hard work.

Re: [boskid][2.0.27] Full Crash on Load of Save (EnemySpawner::findUnitToSendToAttack)

Posted: Fri Dec 20, 2024 11:50 am
by boskid
Thanks for the report, i already noticed this crash in the automatically uploaded crash logs and was able to reproduce this and fix it for 2.0.28 release.

This crash was narrowed down to be triggered by `enemyracemanager` which is using script triggers when units are spawned by enemy spawners to immediately destroy them and create different ones in their place. This interferes with enemy spawner logic which attempts to add the newly created unit to its collection of owned units however the unit was already destroyed by script and so the spawner gets into inconsistent state. In 2.0.27 there was one piece of code added that works based on this assumption (that enemy spawner units should only contain valid units) which it was allowed to do but that made the underlying corruption now manifest itself a little bit more loudly compared to before 2.0.27.

Re: [boskid][2.0.27] Full Crash on Load of Save (EnemySpawner::findUnitToSendToAttack)

Posted: Fri Dec 20, 2024 12:11 pm
by BigDaveNz
Thankyou for the speedy fix. I look forward to 2.0.28.