[0.13.9][posila] CTD Giving a unit group an invalid command

This subforum contains all the issues which we already resolved.
User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

[0.13.9][posila] CTD Giving a unit group an invalid command

Post by Afforess »

No save/mods because this is easy to reproduce.

Create a unit group with several biters, and then give them a "compount command" but with no "commands" field (required API field). The unit_group.set_command does not fail or verify the table contents, but a few moments later, the game exits with this stack trace in the factorio-current.log:

Code: Select all

6306.573 Error CrashHandler.cpp:184: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
6307.135 Warning Logger.cpp:360: Symbols.size() == 39, usedSize == 29
#0  0x7fb95d in Logger::logStacktrace(StackTraceInfo*) at /tmp/factorio-NVN9ia/src/Util/Logger.cpp:382
#1  0x93e29b in CrashHandler::writeStackTrace() at /tmp/factorio-NVN9ia/src/Util/CrashHandler.cpp:84
#2  0x93e514 in CrashHandler::SignalHandler(int) at /tmp/factorio-NVN9ia/src/Util/CrashHandler.cpp:189
#3  0x7fd38624c4a0 in ?? at ??:0
#4  0xc86fc8 in luaH_next(lua_State*, Table*, lua_TValue*) at crtstuff.c:?
#5  0xc7cca5 in lua_next(lua_State*, int) at ??:?
#6  0xaae7c5 in LuaHelper::parseCommand(lua_State*, int) at /tmp/factorio-NVN9ia/src/Util/LuaHelper.cpp:917 (discriminator 3)
#7  0xaaf123 in LuaUnitGroup::luaSetCommand(lua_State*) at /tmp/factorio-NVN9ia/src/Script/LuaUnitGroup.cpp:146
#8  0x44e6ef in LuaBinder<LuaUnitGroup>::callWrapper(lua_State*) at /tmp/factorio-NVN9ia/src/Script/LuaBinder.hpp:310
#9  0xc9084e in luaD_precall(lua_State*, lua_TValue*, int) at crtstuff.c:?
#10 0xc8e73d in luaV_execute(lua_State*) at crtstuff.c:?
#11 0xc90c5e in luaD_call(lua_State*, lua_TValue*, int, int) at crtstuff.c:?
#12 0xc917ad in luaD_pcall(lua_State*, void (*)(lua_State*, void*), void*, long, long) at crtstuff.c:?
#13 0xc7c8b8 in lua_pcallk(lua_State*, int, int, int, int, int (*)(lua_State*)) at ??:?
#14 0xc83d7b in luaB_pcall(lua_State*) at lbaselib.c:?
#15 0xc9084e in luaD_precall(lua_State*, lua_TValue*, int) at crtstuff.c:?
#16 0xc8e73d in luaV_execute(lua_State*) at crtstuff.c:?
#17 0xc90c5e in luaD_call(lua_State*, lua_TValue*, int, int) at crtstuff.c:?
#18 0xc917ad in luaD_pcall(lua_State*, void (*)(lua_State*, void*), void*, long, long) at crtstuff.c:?
#19 0xc7c8b8 in lua_pcallk(lua_State*, int, int, int, int, int (*)(lua_State*)) at ??:?
#20 0x4cad2a in signallingPCall at /tmp/factorio-NVN9ia/src/Script/LuaGameScript.cpp:2361
#21 0x779bcc in runEventHandler at /tmp/factorio-NVN9ia/src/Script/LuaGameScript.cpp:599
#22 0xbd8423 in void LuaEventDispatcher::run<GameAction>(unsigned int, unsigned int, bool (LuaGameScript::*)(GameAction const&), GameAction const&) [clone .constprop.67308] at /tmp/factorio-NVN9ia/src/Script/LuaEventDispatcher.cpp:255
#23 0xbe564c in destroy_content at /home/build/build_environment/boost_1_61_0/output_linux64/include/boost/variant/variant.hpp:1345
#24 0xc04567 in boost::variant<boost::detail::variant::over_sequence<boost::mpl::vector26<PlayerRespawnedData, PlayerPickedUpItemData, PlayerCraftedItemData, PlayerMinedItemData, PlayerEntityPair, RobotEntityPair, ForceIDEntityPair, RadarChunkPair, Player*, Unit*, Chunk*, ResearchFinishedData, ForceID, RobotMinedItemData, ResearchStartedData, TrainChangedStateData, ResourceEntity*, Entity*, ForcesMergedData, EntityPair, PlayerPlacedEquipmentData, PlayerRemovedEquipmentData, TileData, EntityForcePair, GuiChangedData, GuiTextChangedData> >>::~variant() at /home/build/build_environment/boost_1_61_0/output_linux64/include/boost/variant/variant.hpp:1352
#25 0x6d5275 in GameAction::~GameAction() at /tmp/factorio-NVN9ia/src/GameAction.hpp:263
#26 0xf2f433 in dispatch at /tmp/factorio-NVN9ia/src/Script/LuaEventDispatcher.cpp:81
#27 0x7fd3880166fa in update at /tmp/factorio-NVN9ia/src/Script/LuaContext.cpp:136
#28 0x7fd38631db5d in update at /tmp/factorio-NVN9ia/src/Scenario/Scenario.cpp:776
6307.687 Warning Logger.cpp:360: Symbols.size() == 38, usedSize == 28
6307.687 Error CrashHandler.cpp:85: Map tick at moment of crash: 9842040
6307.687 Error Util.cpp:77: 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.
Example code I was using:

Code: Select all

            local command = {type = defines.command.compound, structure_type = defines.compound_command.return_last, command = {
                {type = defines.command.go_to_location, destination = data.ally_base.queen.position},
                {type = defines.command.attack_area, destination = data.ally_base.queen.position, radius = 25}
            }}
            unit_group.set_command(command)
            unit_group.start_moving()
Note that the nested "command" is misspelt, should be "commands".

This should be easy to fix. Unit_Group.set_command should verify the API call is valid.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5316
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.13.9] CTD Giving a unit group an invalid command

Post by Klonan »

Thanks for the report
posila
Factorio Staff
Factorio Staff
Posts: 5427
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.13.9][posila] CTD Giving a unit group an invalid command

Post by posila »

Thanks for the report, fixed for 0.13.10
Post Reply

Return to “Resolved Problems and Bugs”