Page 1 of 1

[Rseding91] [2.0.16] Crash with custom technologies and research triggers.

Posted: Mon Nov 11, 2024 10:02 pm
by ldinc
1. What did I do?

I'm migrating old mods from 1.1 game version to 2.0.
As new feature TRT (Technology Research Trigger) was added I try to integrate it into mod.
The code can be seen in mod file: `apm_power_ldinc/prototypes/main/tech.lua`.

Steps (Example of actions can be found at `00_partial_works_no_exceptions.mkv`):

1) Starts Factorio with mods (attachments folder: mods).
2) Default game settings.
3) Default mod's settings.
4) Starts "New game"->"Freeplay"
5) Default map settings.
6) Click button "Start"
7) If game not crushes after generating new map:
7.1) Check technology tree (visual + debug mode F4)
7.2) Mine nearest stone ore to trigger technology "apm_crusher_machine_1"
7.3) If game not crushes after trigger, try research other "apm_crusher_machine_0" and "apm_crusher_machine_2" by crafting "iron-gear-wheel" and "apm_wood_board". (with cheat mode eneabled or without).


2. What happened?

Starting new freeplay game with mods on default settings lead to 3 results without obvious correlation between actions.
1) The game crushes on starting map, after successfully generation it. (logs/video `01_crash_on_new_map_startup`)
2) The new game starts fine. Starting mine trigger resource (stone ore) leads to crash. (logs/video `02_crash_on_mine_research_trigger`)
3) The new game starts fine. Starting mine trigger resource (stone ore) is fine. The technology has been researched successfully. But other two custom technologies with `craft-item` triggers not works.

3. What did I expect to happen instead?

Technology triggers works fine, similar to original technologies with research triggers instead research units ('steam-engine', 'electronics' and etc).
If stone ore mined, custom technology "apm_crusher_machine_1" researched.
If i've crafted "iron-gear-wheel" or "apm_wood_board" I expected to observe research progress bar on top right game corner.
And after crafting needed count og items - succsessfully research the technology in T-tree.

4. Does it happen always, once, or sometimes?

Randomly. I didn't notice special condition leads to stable reproduce crashes after mining ore.
But broken custom technologies with item-craft research triggers can be reproduce more than stable.

Notices:
The log file has targeting to `TechnologyTriggerProcessor::checkItems`

Code: Select all

C:\Users\build\AppData\Local\Temp\factorio-build-4AGbzM\src\Technology\TechnologyTrigger\TechnologyTriggerProcessor.cpp(98): TechnologyTriggerProcessor::checkItems
C:\Users\build\AppData\Local\Temp\factorio-build-4AGbzM\src\Force\ForceData.cpp(898): ForceData::update
C:\Users\build\AppData\Local\Temp\factorio-build-4AGbzM\src\Map\Map.cpp(1280): Map::updateEntities
C:\Users\build\AppData\Local\Temp\factorio-build-4AGbzM\src\Game.cpp(175): Game::update
C:\Users\build\AppData\Local\Temp\factorio-build-4AGbzM\src\Scenario\Scenario.cpp(1159): Scenario::updateStep
C:\Users\build\AppData\Local\Temp\factorio-build-4AGbzM\src\MainLoop.cpp(1400): MainLoop::gameUpdateStep
C:\Users\build\AppData\Local\Temp\factorio-build-4AGbzM\src\MainLoop.cpp(1209): 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-4AGbzM\src\Util\WorkerThread.cpp(71): WorkerThread::loop
The cases are represented by name of video/log files (example: logs_01_crash_on_new_map_startup)
The videos can be found in folder `video`.
The logs can be found in folder `logs`.
Mods provided by folder `mods`.

description.txt - copy of this message.

The files can be found at Google Drive by URL: https://drive.google.com/drive/folders/ ... sp=sharing

Re: [2.0.16] Build 80214, Experimental + DLC, Windows x64, non-steam. Crash with custom technologies and research trigge

Posted: Sat Nov 16, 2024 12:26 am
by ldinc
2.0.18 Crashing too...

Code: Select all

C:\Users\build\AppData\Local\Temp\factorio-build-mVKqXw\src\Technology\TechnologyTrigger\TechnologyTriggerProcessor.cpp(98): TechnologyTriggerProcessor::checkItems
C:\Users\build\AppData\Local\Temp\factorio-build-mVKqXw\src\Force\ForceData.cpp(898): ForceData::update
C:\Users\build\AppData\Local\Temp\factorio-build-mVKqXw\src\Map\Map.cpp(1280): Map::updateEntities
C:\Users\build\AppData\Local\Temp\factorio-build-mVKqXw\src\Game.cpp(175): Game::update
C:\Users\build\AppData\Local\Temp\factorio-build-mVKqXw\src\Scenario\Scenario.cpp(1160): Scenario::updateStep
C:\Users\build\AppData\Local\Temp\factorio-build-mVKqXw\src\MainLoop.cpp(1400): MainLoop::gameUpdateStep
C:\Users\build\AppData\Local\Temp\factorio-build-mVKqXw\src\MainLoop.cpp(1209): 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-mVKqXw\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*)(ParallelScenarioSaver *),ParallelScenarioSaver *>,0,1>
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp(97): thread_start<unsigned int (__cdecl*)(void *),1>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF846AD257D)
00007FF846AD257D (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF847BAAF08)
00007FF847BAAF08 (ntdll): (filename not available): RtlUserThreadStart

Re: [2.0.16] Build 80214, Experimental + DLC, Windows x64, non-steam. Crash with custom technologies and research trigge

Posted: Sat Nov 16, 2024 4:18 pm
by ldinc
I found another strange behaviour. Reproduces with 2.0.19

Just renaming technology name form `apm_crusher_machine_0` to `apmcrusher` without _ syms leads to work fine without crashes...

Seems very strange.
My hypothesis:
- sym '_' leading to invalid hashing or smth else
- or smth strange with similar name of tech and entity, idk

Re: [2.0.16] Build 80214, Experimental + DLC, Windows x64, non-steam. Crash with custom technologies and research trigge

Posted: Thu Nov 21, 2024 12:45 pm
by ldinc
2.0.20 Still has crashes

Re: [2.0.16] Build 80214, Experimental + DLC, Windows x64, non-steam. Crash with custom technologies and research trigge

Posted: Thu Nov 21, 2024 1:23 pm
by Genhis
Thank you for reporting this issue. Unfortunately I can't load your mod because of "Cannot serialise ttype=function". Please make sure you are not doing anything weird with Lua functions. It would be good to have a minimal mod which can reproduce the crash.

Re: [Rseding91] [2.0.16] Crash with custom technologies and research triggers.

Posted: Thu Nov 21, 2024 2:48 pm
by Rseding91
I was able to work around the mod error and reproduced the issue. It's now fixed for the next release.

Re: [Rseding91] [2.0.16] Crash with custom technologies and research triggers.

Posted: Fri Nov 22, 2024 6:06 pm
by ldinc
Many thanks!