It seems like it's not safe to use a LuaChunkIterator if you happen to delete the chunk that it's currently pointing to. (At least that is my guess)
If it's expected, just mark not a bug. Clearly if I am deleting chunks I need to get a new iterator?
FWIW, I have a mod/scenario that deletes chunks slowly over time to "reclaim land", and I wanted to use the LuaChunkIterator to slowly iterate over each chunk every tick.
Looks like it crashes the game if I'm not careful with it
Code: Select all
1609.606 Deleted 106 chunks. -- THIS IS THE LAST PRINT FROM MY SCENARIO LOGGING CODE
1609.612 Error CrashHandler.cpp:481: Exception Code: c0000005, Address: 0x00007ff72907075a
ModuleBase: 0x00007ff7286c0000, ImageSize: 01b2c000, RelativeAddress: 009b075a
1609.612 Error CrashHandler.cpp:487: Access Violation: Read at address 000000000000082C
1609.612 Error CrashHandler.cpp:501: Exception Context:
rax=00007ff729b6d358, rbx=000002b5e2a570a0, rcx=000002b612e07060,
rdx=00000000019e0368, rsi=0000000000000828, rdi=000002b61310d3f0,
rip=00007ff72907075a, rsp=000000f0e756e930, rbp=000000f0e756e9f0,
r8=000000000000019e, r9=0000000000000040, r10=0000000000000180,
r11=000000f0e756e7c0, r12=000002b607c4a1a0, r13=000002b5e2a570a0,
r14=000002b60d85b240, r15=000002b624fb1520
1609.612 Crashed in C:\Program Files (x86)\Steam\steamapps\common\Factorio\bin\x64\Factorio.exe (0x00007ff7286c0000 - 0x00007ff72a1ec000)
Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-build-n9y63z\libraries\stackwalker\stackwalker.cpp (924): StackWalker::ShowCallstack
c:\cygwin64\tmp\factorio-build-n9y63z\src\util\logger.cpp (542): Logger::writeStacktrace
c:\cygwin64\tmp\factorio-build-n9y63z\src\util\logger.cpp (549): Logger::logStacktrace
c:\cygwin64\tmp\factorio-build-n9y63z\src\util\crashhandler.cpp (185): CrashHandler::writeStackTrace
c:\cygwin64\tmp\factorio-build-n9y63z\src\util\crashhandler.cpp (530): CrashHandler::SehHandler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFC1A74FEEA)
00007FFC1A74FEEA (KERNELBASE): (filename not available): UnhandledExceptionFilter
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFC1D1E4AB2)
00007FFC1D1E4AB2 (ntdll): (filename not available): memset
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFC1D1CC656)
00007FFC1D1CC656 (ntdll): (filename not available): _C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFC1D1E11CF)
00007FFC1D1E11CF (ntdll): (filename not available): _chkstk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFC1D1AA209)
00007FFC1D1AA209 (ntdll): (filename not available): RtlRaiseException
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFC1D1DFE3E)
00007FFC1D1DFE3E (ntdll): (filename not available): KiUserExceptionDispatcher
c:\cygwin64\tmp\factorio-build-n9y63z\src\util\luahelper.cpp (520): LuaHelper::pushChunkPosition
c:\cygwin64\tmp\factorio-build-n9y63z\src\script\luachunkiterator.cpp (109): LuaChunkIterator::luaCall
c:\cygwin64\tmp\factorio-build-n9y63z\src\script\luabinder.hpp (327): LuaBinder<LuaFluidBoxPrototype>::callWrapper
c:\cygwin64\tmp\factorio-build-n9y63z\libraries\lua\ldo.c (350): luaD_precall
c:\cygwin64\tmp\factorio-build-n9y63z\libraries\lua\lvm.c (713): luaV_execute
c:\cygwin64\tmp\factorio-build-n9y63z\libraries\lua\lapi.c (1057): f_call
c:\cygwin64\tmp\factorio-build-n9y63z\libraries\lua\ldo.c (137): luaD_rawrunprotected
c:\cygwin64\tmp\factorio-build-n9y63z\libraries\lua\ldo.c (623): luaD_pcall
c:\cygwin64\tmp\factorio-build-n9y63z\libraries\lua\lapi.c (1083): lua_pcallk
c:\cygwin64\tmp\factorio-build-n9y63z\src\util\luahelper.cpp (4112): LuaHelper::pCallWithStackTrace
c:\cygwin64\tmp\factorio-build-n9y63z\src\script\luagamescript.cpp (1057): LuaGameScript::runEventHandler
c:\cygwin64\tmp\factorio-build-n9y63z\src\script\luaeventdispatcher.cpp (621): LuaEventDispatcher::run
c:\cygwin64\tmp\factorio-build-n9y63z\src\script\luaeventdispatcher.cpp (97): LuaEventDispatcher::dispatch
c:\cygwin64\tmp\factorio-build-n9y63z\src\scenario\scenario.cpp (1215): Scenario::update
c:\cygwin64\tmp\factorio-build-n9y63z\src\mainloop.cpp (1172): MainLoop::gameUpdateStep
c:\cygwin64\tmp\factorio-build-n9y63z\src\mainloop.cpp (1039): MainLoop::gameUpdateLoop
c:\cygwin64\tmp\factorio-build-n9y63z\src\util\workerthread.cpp (49): WorkerThread::loop
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (230): std::_LaunchPad<std::unique_ptr<std::tuple<void (__cdecl MapGenerationHelper::*)(void),MapGenerationHelper *>,std::default_delete<std::tuple<void (__cdecl MapGenerationHelper::*)(void),MapGenerationHelper *> > > >::_Go
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (209): std::_Pad::_Call_func
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp (115): thread_start<unsigned int (__cdecl*)(void * __ptr64)>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFC1BCB7BD4)
00007FFC1BCB7BD4 (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFC1D1ACE51)
00007FFC1D1ACE51 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
1611.649 Error CrashHandler.cpp:190: Map tick at moment of crash: 399600
1611.649 Error Util.cpp:97: 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.
1626.692 Uploading log file
1626.704 Error CrashHandler.cpp:259: Heap validation: success.
1626.705 Creating crash dump.
1626.927 CrashDump success