So while developing Mining Robots for MoMining, Ive ran into a odd quirk involving belts and manually spawning item stacks. And it just causes the game to crash, with the logs pointing to the itself erroring out.
However I was able to work around it and forgot to setup a bug report when i discovered it. (Now it comes back during the all time low of bug reports.... )
(Those of you who have MoMining installed, don't worry the version used in this bug report is modified to have its safety's disabled. You wont crash to this error.)
Factorio Log....
0.002 2015-12-11 11:56:17; Factorio 0.12.20 (Build 17489, win64)
0.002 Operating system: Windows 7 Service Pack 1
0.002 Program arguments: "C:\Users\Ludsoe\Desktop\Factorio_0.12.20\bin\x64\Factorio.exe"
0.002 Read data path: C:/Users/Ludsoe/Desktop/Factorio_0.12.20/data
0.002 Write data path: C:/Users/Ludsoe/Desktop/Factorio_0.12.20
0.002 Binaries path: C:/Users/Ludsoe/Desktop/Factorio_0.12.20/bin
0.021 Available display adapters: 1
0.021 [0]: \\.\DISPLAY1 - NVIDIA GeForce GTX 750 {0x05, [0,0], 1920x1080, 32bit, 60Hz}
0.021 Create display on adapter 0. Size 1280x720 at position [310, 162]. Monitor 0
0.514 Initialised Direct3D:[0] NVIDIA GeForce GTX 750; driver: nvd3dumx.dll 10.18.13.5906
0.555 Desktop composition is active.
0.555 Graphics options: [FullScreen: false] [VSync: true] [UIScale: 100%] [MultiSampling: OFF] [Graphics quality: normal] [Video memory usage: high] [Light scale: 20%] [Screen: 0]
0.632 Loading mod core 0.0.0 (data.lua)
0.635 Loading mod base 0.12.20 (data.lua)
0.730 Loading mod momining 0.1.1 (data.lua)
1.454 Initial atlas bitmap size is 16384
1.457 Created atlas bitmap 16384x5505
16.568 Factorio initialised
257.951 Info Scenario.cpp:123: Map version 0.12.20-1
299.931 Info Scenario.cpp:123: Map version 0.12.20-1
Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-s8xnhp\libraries\stackwalker\stackwalker.cpp (923): StackWalker::ShowCallstack
c:\cygwin64\tmp\factorio-s8xnhp\src\util\logger.cpp (284): Logger::writeStacktrace
c:\cygwin64\tmp\factorio-s8xnhp\src\util\logger.cpp (338): Logger::logStacktrace
c:\cygwin64\tmp\factorio-s8xnhp\src\util\crashhandler.cpp (81): CrashHandler::writeStackTrace
c:\cygwin64\tmp\factorio-s8xnhp\src\util\crashhandler.cpp (90): CrashHandler::SehHandler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007756B990)
000000007756B990 (kernel32): (filename not available): UnhandledExceptionFilter
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007767A0B8)
000000007767A0B8 (ntdll): (filename not available): EtwEventSetInformation
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 0000000077608008)
0000000077608008 (ntdll): (filename not available): _C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007761905D)
000000007761905D (ntdll): (filename not available): RtlDecodePointer
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 0000000077608C0F)
0000000077608C0F (ntdll): (filename not available): RtlUnwindEx
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007763D948)
000000007763D948 (ntdll): (filename not available): KiUserExceptionDispatcher
ERROR: SymGetSymFromAddr64, GetLastError: 126 (Address: 0000011993052200)
ERROR: SymGetLineFromAddr64, GetLastError: 126 (Address: 0000011993052200)
ERROR: SymGetModuleInfo64, GetLastError: 1114 (Address: 0000011993052200)
0000011993052200 ((module-name not available)): (filename not available): (function-name not available)
c:\cygwin64\tmp\factorio-s8xnhp\src\logistics\constructionmanager.cpp (331): ConstructionManager::processToDeconstructQueue
c:\cygwin64\tmp\factorio-s8xnhp\src\logistics\constructionmanager.cpp (237): ConstructionManager::sendRobotsToDeconstruct
c:\cygwin64\tmp\factorio-s8xnhp\src\force\forcedata.cpp (292): ForceData::update
c:\cygwin64\tmp\factorio-s8xnhp\src\map\map.cpp (917): Map::update
c:\cygwin64\tmp\factorio-s8xnhp\src\game.cpp (144): Game::update
c:\cygwin64\tmp\factorio-s8xnhp\src\scenario\scenario.cpp (729): Scenario::update
c:\cygwin64\tmp\factorio-s8xnhp\src\mainloop.cpp (262): MainLoop::gameUpdateStep
c:\cygwin64\tmp\factorio-s8xnhp\src\mainloop.cpp (368): MainLoop::updateLoop
c:\boost_1_58_0\boost\function\function_template.hpp (160): boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void,void (__cdecl*)(ThreadBarrier * __ptr64,boost::chrono::time_point<boost::chrono::steady_clock,boost::chrono::duration<__int64,boost::ratio<1,1000000000> > > * __ptr64,boost::chrono::time_point<boost::chrono::steady_clock,boost::chrono::duration<__int64,boost::ratio<1,1000000000> > > * __ptr64,bool * __ptr64,bool),boost::_bi::list5<boost::_bi::value<ThreadBarrier * __ptr64>,boost::_bi::value<boost::chrono::time_point<boost::chrono::steady_clock,boost::chrono::duration<__int64,boost::ratio<1,1000000000> > > * __ptr64>,boost::_bi::value<boost::chrono::time_point<boost::chrono::steady_clock,boost::chrono::duration<__int64,boost::ratio<1,1000000000> > > * __ptr64>,boost::_bi::value<bool * __ptr64>,boost::_bi::value<bool> > >,void>::invoke
c:\cygwin64\tmp\factorio-s8xnhp\src\util\thread.cpp (34): Thread::loop
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000013F4FC923)
000000013F4FC923 (Factorio): (filename not available): boost::`anonymous namespace'::thread_start_function
f:\dd\vctools\crt\crtw32\startup\threadex.c (376): _callthreadstartex
f:\dd\vctools\crt\crtw32\startup\threadex.c (354): _threadstartex
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00000000774E5A4D)
00000000774E5A4D (kernel32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007761B831)
000000007761B831 (ntdll): (filename not available): RtlUserThreadStart
410.802 Error Util.cpp:63: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
How to replicate:
Install the mod, and then load the save.
After the game is loaded there should be a mining robotics port entity next to the player, which uses the sprite of a furnace.
Place a stack of construction robots into it, and the game should immediately crash.
Re: [0.12.20] Odd crash involving belts
Posted: Fri Dec 11, 2015 8:17 pm
by Rseding91
You describe how to make it crash but you didn't describe how you got the transport belts and the item stacks to interact weirdly
Could you describe that part? That's going to be where the fix comes in.
Re: [0.12.20] Odd crash involving belts
Posted: Sat Dec 12, 2015 2:50 am
by ludsoe
Well based on my observations it seems to involve newly spawned item stacks trying to fit on a belt entity that's currently completely full.
Exactly what I do
But for as how I do it, well first I pick a location.
And then I run find_non_colliding_position for "item-on-ground" to get a position to spawn the item stack.
I then take that position and use create_entity to spawn the "item-on-ground" entity.
Also I'm unsure if this is important, but I then call order_deconstruction on that item stack to force the robots to pick it up. (Except they don't get a chance to even leave their roboport since it just crash's immediatly.)
And finally I repeat the last 4 steps up to 30 times every mining cycle.
0.000 2015-12-12 14:16:49; Factorio 0.12.20 (Build 17489, linux64)
0.000 Operating system: Linux
0.000 Program arguments: "./factorio"
0.000 Read data path: /home/prg/Downloads/factorio/data
0.000 Write data path: /home/prg/Downloads/factorio
0.000 Binaries path: /home/prg/Downloads/factorio/bin
0.048 Available display adapters: 2
0.048 [0]: resolution 1280x1024px at [0,0]
0.048 [1]: resolution 1024x768px at [1280,0]
0.048 Create display on adapter 1. Size 1280x720 at position [0, 134]. Monitor 0
0.113 Initialised OpenGL:[1] GeForce GTX 660/PCIe/SSE2; driver: 4.5.0 NVIDIA 358.16
0.140 Graphics options: [FullScreen: false] [VSync: false] [UIScale: 100%] [MultiSampling: OFF] [Graphics quality: normal] [Video memory usage: all] [Light scale: 100%] [Screen: 255]
0.164 Loading mod core 0.0.0 (data.lua)
0.165 Loading mod base 0.12.20 (data.lua)
0.515 Initial atlas bitmap size is 16384
0.517 Created atlas bitmap 16384x7759
5.863 Factorio initialised
11.460 Info Scenario.cpp:123: Map version 0.12.20-1
21.348 Verbose Scenario.cpp:514: Saving game as /home/prg/Downloads/factorio/saves/crashme
24.691 Verbose Scenario.cpp:514: Saving game as /home/prg/Downloads/factorio/saves/crashme
30.519 Verbose Scenario.cpp:514: Saving game as /home/prg/Downloads/factorio/saves/crashme
36.071 Verbose Scenario.cpp:514: Saving game as /home/prg/Downloads/factorio/saves/crashme
36.515 Warning Logger.cpp:316: Symbols.size() == 20, usedSize == 8
Factorio crashed. Generating symbolized stacktrace, please wait ...
36.884 Warning Logger.cpp:316: Symbols.size() == 19, usedSize == 7
#0 0x7f625533e440 in ?? at ??:0
#1 0x669b41 in ForceData::preSaveHook(MapSerialiser&) const [clone .constprop.54692] at /tmp/factorio-ZIIOVU/src/Util/Targetable.cpp:90
#2 0x9612b6 in TargeterBase::TargeterBase(Targetable*) at /tmp/factorio-ZIIOVU/src/Util/Targeter.cpp:14
#3 0x9624ff in Targeter<Entity>::Targeter(Entity*) at /tmp/factorio-ZIIOVU/src/Util/Targeter.hpp:68
#4 0xd4144f in DeconstructionOrderItem::DeconstructionOrderItem(DeconstructionOrder const&) at /tmp/factorio-ZIIOVU/src/Logistics/LogisticSaveLoadHelper.hpp:90
#5 0x7f6256f27324 in construct<DeconstructionOrderItem, const DeconstructionOrder&> at /usr/include/c++/5/ext/new_allocator.h:120
#6 0x7f62553f31cd in _S_construct<DeconstructionOrderItem, const DeconstructionOrder&> at /usr/include/c++/5/bits/alloc_traits.h:256
36.884 Error Util.cpp:63: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
37.356 Warning Logger.cpp:316: Symbols.size() == 12, usedSize == 9
Factorio crashed. Generating symbolized stacktrace, please wait ...
37.744 Warning Logger.cpp:316: Symbols.size() == 11, usedSize == 8
#0 0x7f625533e440 in ?? at ??:0
#1 0x626ce8 in ControlInput::Value::checkModifiers(InputState const&) at /tmp/factorio-ZIIOVU/src/Input/ControlInput.cpp:437
#2 0x6f7185 in ControlInput::Value::triggeredBy(ALLEGRO_EVENT const&, InputState const&, bool, bool) at /tmp/factorio-ZIIOVU/src/Input/ControlInput.cpp:370
#3 0xa16fc9 in MainLoop::processAllegroEvents(bool) at /tmp/factorio-ZIIOVU/src/Input/AppInputListener.cpp:10
#4 0xa349ce in processAllegroEvent at /tmp/factorio-ZIIOVU/src/MainLoop.cpp:123
#5 0xa8806e in processAllegroEvents at /tmp/factorio-ZIIOVU/src/MainLoop.cpp:169
#6 0x7f625532b7b0 in MainLoop::run(boost::filesystem::path const&, boost::filesystem::path const&, bool, bool, std::string const&) [clone .constprop.51658] at /tmp/factorio-ZIIOVU/src/MainLoop.cpp:445
#7 0x40a379 in run at /tmp/factorio-ZIIOVU/src/MainLoop.cpp:566
37.744 Error Util.cpp:63: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
(this even seems to have crashed twice)
The backtrace looks different, but it seems to have the same cause: ordering deconstruction of an item-on-ground created on a transport belt.
Re: [0.12.20] Odd crash involving belts
Posted: Sat Dec 12, 2015 8:05 pm
by Rseding91
Ahhh I see what the problem is
The transport belt is destroying the item entity because it absorbed it. However, the API is also letting you call mark for deconstruction after it has been destroyed.
Re: [0.12.20] [kovarex] Odd crash involving belts
Posted: Tue Dec 29, 2015 4:14 pm
by kovarex
Thanks for the report, it is fixed now in 0.12.21.
The LuaEntity object is now properly invalidated when "consumed" by the belt.