Page 1 of 1

[0.15.9] LuaRemote freezes game completely

Posted: Tue May 09, 2017 7:13 am
by folk
Hi,
https://cdn.discordapp.com/attachments/ ... 0.1.10.zip

1. Download ZIP above and put it in the mods folder
2. Disable all other mods
3. Start a new game
4. Open the game menu and click the "Restart" button

Results: The game freezes completely.

Now, the interesting code is on line 1 of control.lua:

Code: Select all

local ev = require("lib-events")
You can ignore the rest of control.lua, I'm quite sure. This return value; |ev|, is not used anywhere. If you comment out or remove this line from control.lua, the game no longer freezes on step 4.

So, a logical conclusion seems to be that it must be the code in lib-events.lua that is problematic. So here it is;

Code: Select all

local MAJOR, MINOR, register = "lib-events", 1, true
local eventIds
if remote.interfaces[MAJOR] then
	local existingIds = remote.call(MAJOR, "getEventIds")
	if type(existingIds) ~= "nil" then eventIds = existingIds
	else error("Previous version of lib-events did not pass on the registered event IDs.") end
	local version = remote.call(MAJOR, "version")
	if type(version) == "number" and version <= MINOR then register = false
	else
		remote.remove_interface(MAJOR)
		print("More recent version of lib-events has been detected.")
	end
end
if register then
	if type(eventIds) ~= "table" then eventIds = {} end
	local function getId(name)
		if not eventIds[name] then eventIds[name] = script.generate_event_name() end
		return eventIds[name]
	end
	local function trigger(name, ...)
		if not eventIds[name] then return end
		script.raise_event(eventIds[name], {...})
	end
	remote.add_interface(MAJOR, {
		getId=getId,
		trigger=trigger,
		version=function() return MINOR end,
		getEventIds=function() return eventIds end,
	})
end
local m = {
	trigger = function(...) remote.call(MAJOR, "trigger", ...) end,
	register = function(name, funcref)
		script.on_event((remote.call(MAJOR, "getId", name)), funcref)
	end,
}
return m
And for the life of me, I can't see any problems with it.

Re: [0.15.9] LuaRemote freezes game completely

Posted: Tue May 09, 2017 7:17 am
by folk
This crash log might be related, but as you can see in this game I had lots of addons enabled.
I only think it might be related because of this line:
#8 0x0000000000cc43c5 in LuaInterface::~LuaInterface() at /tmp/factorio-pQPxC1/src/Script/LuaRemote.hpp:8

Code: Select all

folk@plantasjen:~/Programs/factorio/bin/x64$ ./factorio 
   0.000 2017-05-08 23:43:18; Factorio 0.15.9 (build 29504, linux64, alpha)
   0.065 Operating system: Linux (Ubuntu 17.10)
   0.065 Program arguments: "./factorio" 
   0.065 Read data path: /home/folk/Programs/factorio/data
   0.065 Write data path: /home/folk/Programs/factorio
   0.065 Binaries path: /home/folk/Programs/factorio/bin
   0.075 System info: [CPU:        Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz, 4 cores, RAM: 7928MB]
   0.076 Display options: [FullScreen: 1] [VSync: 1] [UIScale: 120.968%] [MultiSampling: OFF] [Screen: 255]
   0.140 Available display adapters: 1
   0.140  [0]: resolution 1920x1200px at [0,0]
   0.140 Create display on adapter 0. Size 1548x870 at position [176, 147].
   0.481 Initialised OpenGL:[0] GeForce GTX 680/PCIe/SSE2; driver: 4.5.0 NVIDIA 378.13
   0.483     Video memory size (dedicated/total available/current available): 2048/2048/1749 MB
   0.810 Graphics settings preset: very-high
   0.811 Graphics options: [Graphics quality: normal] [Video memory usage: high] [Light scale: 25%] [DXT: auto]
   0.956 Loading mod settings angelsinfiniteores 0.6.6 (settings.lua)
   0.957 Loading mod settings AsphaltRoads 1.0.4 (settings.lua)
   0.957 Loading mod settings creative-mode 0.3.2 (settings.lua)
   0.960 Loading mod settings folk-colorequipment 0.1.3 (settings.lua)
   0.960 Loading mod settings folk-fill 0.2.1 (settings.lua)
   0.961 Loading mod settings long-reach 0.0.8 (settings.lua)
   0.961 Loading mod settings folk-shuttle 0.1.10 (settings.lua)
   0.961 Loading mod settings LogisticTrainNetwork 1.2.2 (settings.lua)
   0.966 Loading mod core 0.0.0 (data.lua)
   0.973 Loading mod base 0.15.9 (data.lua)
   1.061 Loading mod aai-vehicles-flame-tumbler 0.2.3 (data.lua)
   1.130 Loading mod Advanced-Electric 0.1.3 (data.lua)
   1.202 Loading mod angelsinfiniteores 0.6.6 (data.lua)
   1.278 Loading mod AsphaltRoads 1.0.4 (data.lua)
   1.352 Loading mod BetterIcons 1.3.0 (data.lua)
   1.428 Loading mod Big_Brother 0.4.2 (data.lua)
   1.529 Loading mod cheaper_landfill 1.1.1 (data.lua)
   1.609 Loading mod Chunky_Roboports 0.0.1 (data.lua)
   1.713 Loading mod color-coding 1.15.3 (data.lua)
   1.794 Loading mod creative-mode 0.3.2 (data.lua)
   1.887 Loading mod EvenMoreLight 0.0.5 (data.lua)
   1.987 Loading mod Flow Control 3.0.1 (data.lua)
   2.094 Loading mod folk-aquarium 0.1.4 (data.lua)
   2.184 Loading mod folk-borax 0.1.2 (data.lua)
   2.284 Loading mod folk-colorequipment 0.1.3 (data.lua)
   2.408 Loading mod folk-logistic-wagon 0.2.4 (data.lua)
   2.502 Loading mod folk-radar 0.1.3 (data.lua)
   2.594 Loading mod folk-textprint 0.1.5 (data.lua)
   2.711 Loading mod Honk 2.1.3 (data.lua)
   2.843 Loading mod MoreConcreteSlot 0.1.2 (data.lua)
   2.946 Loading mod mydecals 0.1.7 (data.lua)
   3.080 Loading mod ore-eraser 1.4.0 (data.lua)
   3.183 Loading mod personalmod 0.1.0 (data.lua)
   3.285 Loading mod Reinforced-Walls 0.15.1 (data.lua)
   3.427 Loading mod robotarmy 0.3.2 (data.lua)
   3.545 Loading mod stumps-be-gone 0.1.2 (data.lua)
   3.662 Loading mod textplates 0.2.3 (data.lua)
   3.832 Loading mod VehicleGrid 0.1.1 (data.lua)
   3.993 Loading mod folk-shuttle 0.1.10 (data.lua)
   4.204 Loading mod LogisticTrainNetwork 1.2.2 (data.lua)
   4.373 Loading mod base 0.15.9 (data-updates.lua)
   4.539 Loading mod AsphaltRoads 1.0.4 (data-updates.lua)
   4.752 Loading mod Big_Brother 0.4.2 (data-updates.lua)
   4.907 Loading mod folk-borax 0.1.2 (data-updates.lua)
   5.068 Loading mod robotarmy 0.3.2 (data-updates.lua)
   5.291 Loading mod Squeak Through 1.1.7 (data-updates.lua)
   5.394 Loading mod Supercharged_Roboports 0.1.2 (data-updates.lua)
   5.550 Loading mod VehicleGrid 0.1.1 (data-updates.lua)
   5.747 Loading mod angelsinfiniteores 0.6.6 (data-final-fixes.lua)
   5.908 Loading mod creative-mode 0.3.2 (data-final-fixes.lua)
   6.101 Loading mod folk-aquarium 0.1.4 (data-final-fixes.lua)
   6.259 Loading mod folk-borax 0.1.2 (data-final-fixes.lua)
   6.444 Loading mod folk-colorequipment 0.1.3 (data-final-fixes.lua)
   6.595 Loading mod folk-radar 0.1.3 (data-final-fixes.lua)
   6.752 Loading mod mydecals 0.1.7 (data-final-fixes.lua)
   6.978 Loading mod personalmod 0.1.0 (data-final-fixes.lua)
   7.144 Loading mod folk-shuttle 0.1.10 (data-final-fixes.lua)
   7.312 Loading mod LogisticTrainNetwork 1.2.2 (data-final-fixes.lua)
   7.313 Script data-final-fixes.lua:2: [LTN] generating virtual signals
   7.313 Script data-final-fixes.lua:21: [LTN] 1 locomotives added
   7.313 Script data-final-fixes.lua:59: [LTN] 6 wagons added
   7.524 Checksum for core: 3409166051
   7.524 Checksum of base: 3769930138
   7.524 Checksum of aai-vehicles-flame-tumbler: 224635166
   7.524 Checksum of Advanced-Electric: 1095695026
   7.524 Checksum of angelsinfiniteores: 3019351139
   7.524 Checksum of AsphaltRoads: 1543587486
   7.525 Checksum of auto-stock: 0
   7.525 Checksum of BetterIcons: 239297742
   7.525 Checksum of Big_Brother: 1188679049
   7.525 Checksum of cheaper_landfill: 2109052305
   7.525 Checksum of Chunky_Roboports: 2914827174
   7.525 Checksum of color-coding: 1304164671
   7.525 Checksum of creative-mode: 2031026951
   7.525 Checksum of EvenMoreLight: 3121325654
   7.525 Checksum of Flow Control: 777216705
   7.525 Checksum of folk-aquarium: 2385483743
   7.525 Checksum of folk-borax: 1502293105
   7.525 Checksum of folk-colorequipment: 602476429
   7.525 Checksum of folk-fill: 4200094197
   7.525 Checksum of folk-janitor: 0
   7.525 Checksum of folk-justgo: 0
   7.525 Checksum of folk-logistic-wagon: 334996869
   7.525 Checksum of folk-radar: 339329963
   7.525 Checksum of folk-textprint: 76747098
   7.525 Checksum of Honk: 3337765968
   7.525 Checksum of long-reach: 3995667697
   7.525 Checksum of MoreConcreteSlot: 2831335915
   7.525 Checksum of mydecals: 1554166632
   7.525 Checksum of ore-eraser: 431622073
   7.525 Checksum of personalmod: 1644840152
   7.525 Checksum of Reinforced-Walls: 1086868654
   7.525 Checksum of robotarmy: 1655996762
   7.525 Checksum of Squeak Through: 3430405470
   7.525 Checksum of stumps-be-gone: 912440180
   7.525 Checksum of Supercharged_Roboports: 280941926
   7.525 Checksum of textplates: 253303390
   7.525 Checksum of VehicleGrid: 852796394
   7.525 Checksum of folk-shuttle: 4087576855
   7.525 Checksum of LogisticTrainNetwork: 257721499
   7.743 Info PlayerData.cpp:55: Local player-data.json available, timestamp 1494278016
   7.743 Info PlayerData.cpp:62: Cloud player-data.json unavailable
   7.820 Loaded shader file /home/folk/Programs/factorio/data/core/graphics/shaders/game.glsl
   7.820 Loaded shader file /home/folk/Programs/factorio/data/core/graphics/shaders/zoom-to-world.glsl
   7.837 Initial atlas bitmap size is 16384
   7.841 Created atlas bitmap 16384x7004
   7.843 Created atlas bitmap 4096x4092
   7.845 Created atlas bitmap 4096x4092
   7.846 Created atlas bitmap 4096x4096
   7.847 Created atlas bitmap 4096x896
   7.847 Created atlas bitmap 4096x2316
   7.851 Created atlas bitmap 4096x3648
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
  22.786 Sprites loaded
  22.786 Convert atlas 4096x4092 to: compressed 
  23.582 Convert atlas 4096x4092 to: compressed 
  24.194 Convert atlas 4096x4096 to: compressed 
  24.820 Convert atlas 4096x896 to: compressed 
  24.902 Convert atlas 4096x2316 to: trilinear-filtering 
  24.974 Convert atlas 4096x3648 to: mipmap 
  25.086 Loading sounds...
  27.208 Custom inputs active: 4
  27.208 Info Updater.cpp:753: Downloading https://updater.factorio.com/get-available-versions?username=folk&token=<private>&apiVersion=2
  28.403 0 packages available to download (experimental updates enabled).
  28.455 Factorio initialised
  38.688 Loading map /home/folk/Programs/factorio/saves/freetynne shuttle.zip: 30052222 bytes.
  38.689 Error FileUtil.cpp:291: Can't remove /home/folk/Programs/factorio/temp/currently-playing: No such file or directory
  38.703 Loading Level.dat: 76599953 bytes.
  38.711 Info Scenario.cpp:133: Map version 0.15.5-1
  38.725 Info PrototypeMigrationList.cpp:51: Activating migration aai-vehicles-flame-tumbler/aai-vehicles-flame-tumbler_0.2.2.json
  38.725 Warning PrototypeMigrationList.cpp:191: "flame-tumbler-flame-thrower" mentioned as FROM in prototype migration was not found in the map prototype dictionary, ignoring ...
  38.725 Info PrototypeMigrationList.cpp:51: Activating migration creative-mode/creative-mode_0.3.2.json
  38.725 Info PrototypeMigrationList.cpp:51: Activating migration textplates/textplates_0.2.2.json
  38.725 Warning PrototypeMigrationList.cpp:191: "flame-tumbler-flame-thrower" mentioned as FROM in prototype migration was not found in the map prototype dictionary, ignoring ...
  42.212 Info PrototypeMigrationList.cpp:51: Activating migration aai-vehicles-flame-tumbler/aai-vehicles-flame-tumbler_0.2.2.json
  42.212 Warning PrototypeMigrationList.cpp:191: "flame-tumbler-flame-thrower" mentioned as FROM in prototype migration was not found in the map prototype dictionary, ignoring ...
  42.212 Info PrototypeMigrationList.cpp:51: Activating migration creative-mode/creative-mode_0.3.2.json
  42.212 Info PrototypeMigrationList.cpp:51: Activating migration robotarmy/robotarmy_0.1.4.json
  42.212 Warning PrototypeMigrationList.cpp:191: "droid" mentioned as FROM in prototype migration was not found in the map prototype dictionary, ignoring ...
  42.212 Info PrototypeMigrationList.cpp:51: Activating migration textplates/textplates_0.2.2.json
  42.212 Warning PrototypeMigrationList.cpp:191: "flame-tumbler-flame-thrower" mentioned as FROM in prototype migration was not found in the map prototype dictionary, ignoring ...
  42.222 Applying migration: AAI Vehicles: Flame Tumbler: aai-vehicles-flame-tumbler_0.2.3.lua
  42.223 Applying migration: Color Coding: 0.15.3_reenable_fire_recipes.lua
  42.224 Applying migration: Creative Mode: creative-mode_0.3.2.lua
  42.226 Applying migration: Robot Army: robotarmy_0.3.1.lua
  42.233 Loading script.dat: 211353 bytes.
  42.235 Checksum for script /home/folk/Programs/factorio/temp/currently-playing/control.lua: 76911248
  42.236 Checksum for script __AsphaltRoads__/control.lua: 1505263021
  42.236 Checksum for script __auto-stock__/control.lua: 2388414057
  42.240 Checksum for script __Big_Brother__/control.lua: 549854449
  42.263 Checksum for script __creative-mode__/control.lua: 1560288851
  42.264 Checksum for script __Flow Control__/control.lua: 3027294436
  42.265 Checksum for script __folk-aquarium__/control.lua: 4155503651
  42.266 Checksum for script __folk-borax__/control.lua: 670337668
  42.267 Checksum for script __folk-colorequipment__/control.lua: 1150150201
  42.268 Checksum for script __folk-fill__/control.lua: 82941756
  42.269 Checksum for script __folk-janitor__/control.lua: 334226043
  42.270 Checksum for script __folk-justgo__/control.lua: 901300229
  42.271 Checksum for script __folk-logistic-wagon__/control.lua: 515118277
  42.272 Checksum for script __folk-radar__/control.lua: 1980650866
  42.274 Checksum for script __folk-textprint__/control.lua: 256928913
  42.275 Checksum for script __Honk__/control.lua: 1248643386
  42.275 Checksum for script __long-reach__/control.lua: 148492066
  42.276 Checksum for script __MoreConcreteSlot__/control.lua: 0
  42.277 Checksum for script __mydecals__/control.lua: 1906373903
  42.278 Checksum for script __ore-eraser__/control.lua: 768765303
  42.284 Checksum for script __robotarmy__/control.lua: 1234605130
  42.285 Checksum for script __textplates__/control.lua: 2413783246
  42.287 Checksum for script __folk-shuttle__/control.lua: 3370280962
  42.290 Checksum for script __LogisticTrainNetwork__/control.lua: 890554411
  42.444 Script control.lua:146: [LTN] on_load: complete
onconfchangeshuttle
  42.560 Script control.lua:176: [LTN] on_configuration_changed: LogisticTrainNetwork 1.2.2 initialized. Previous version: 1.2.0
 127.050 Error CrashHandler.cpp:232: Received SIGSEGV
 127.815 Warning Logger.cpp:386: Symbols.size() == 32, usedSize == 18
Factorio crashed. Generating symbolized stacktrace, please wait ...
 128.562 Warning Logger.cpp:386: Symbols.size() == 31, usedSize == 17
#0  0x00000000006e9390 in CrashHandler::writeStackTrace() at /tmp/factorio-pQPxC1/src/Util/CrashHandler.cpp:105
#1  0x00000000006e9614 in CrashHandler::SignalHandler(int) at /tmp/factorio-pQPxC1/src/Util/CrashHandler.cpp:237
#2  0x00007fb951ebe7f0 in ?? at ??:0
#3  0x0000000000eb81c5 in luaH_newkey(lua_State*, Table*, lua_TValue const*) at crtstuff.c:?
#4  0x0000000000eb8e7e in luaH_setint(lua_State*, Table*, int, lua_TValue*) at crtstuff.c:?
#5  0x0000000000eacc4a in lua_rawseti(lua_State*, int, int) at ??:?
#6  0x000000000070f7af in std::string::_M_rep() const at /usr/include/c++/5/bits/basic_string.h:2697
#7  0x0000000000a94d95 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at /usr/include/c++/5/bits/basic_string.h:2943
#8  0x0000000000cc43c5 in LuaInterface::~LuaInterface() at /tmp/factorio-pQPxC1/src/Script/LuaRemote.hpp:8
#9  0x0000000000d3f43a in operator() at /usr/include/c++/5/bits/unique_ptr.h:76
#10 0x0000000000df6ed8 in std::unique_ptr<LuaInterface, std::default_delete<LuaInterface> >::~unique_ptr() at /usr/include/c++/5/bits/unique_ptr.h:236
#11 0x0000000000e315d3 in destroy<std::unique_ptr<LuaInterface> > at /usr/include/c++/5/ext/new_allocator.h:124
#12 0x0000000000e32c6f in _S_destroy<std::unique_ptr<LuaInterface> > at /usr/include/c++/5/bits/alloc_traits.h:285
#13 0x0000000000e36fc3 in destroy<std::unique_ptr<LuaInterface> > at /usr/include/c++/5/bits/alloc_traits.h:414
#14 0x0000000000ea5fd6 in _M_destroy_node at /usr/include/c++/5/bits/stl_tree.h:553
#15 0x00007fb951ea93f1 in _M_drop_node at /usr/include/c++/5/bits/stl_tree.h:561
#16 0x000000000040aae9 in _M_erase at /usr/include/c++/5/bits/stl_tree.h:1614
 128.563 Error CrashHandler.cpp:106: Map tick at moment of crash: 19964700
 128.563 Error Util.cpp:76: 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.

------------- Error -------------
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.

Log file location: /home/folk/Programs/factorio/factorio-current.log

Would you like to copy the path to the clipboard?
---------------------------------
Segmentation fault

Re: [0.15.9] LuaRemote freezes game completely

Posted: Tue May 09, 2017 7:20 am
by folk
Actually, I got the crash from the previous post with only this mod enabled; all you have to do is uncomment line 41 in control.lua:
ev.trigger(event.setting, event.player_index, value)

Code: Select all

 520.365 Warning Logger.cpp:386: Symbols.size() == 30, usedSize == 16
Factorio crashed. Generating symbolized stacktrace, please wait ...
 521.082 Warning Logger.cpp:386: Symbols.size() == 29, usedSize == 15
#0  0x00000000006e9390 in CrashHandler::writeStackTrace() at /tmp/factorio-pQPxC1/src/Util/CrashHandler.cpp:105
#1  0x00000000006e9614 in CrashHandler::SignalHandler(int) at /tmp/factorio-pQPxC1/src/Util/CrashHandler.cpp:237
#2  0x00007f49ec7b87f0 in ?? at ??:0
#3  0x0000000000eac3a8 in lua_rawgeti(lua_State*, int, int) at ??:?
#4  0x0000000000eb6801 in luaL_unref(lua_State*, int, int) at ??:?
#5  0x000000000070f7af in std::string::_M_rep() const at /usr/include/c++/5/bits/basic_string.h:2697
#6  0x0000000000a94d95 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at /usr/include/c++/5/bits/basic_string.h:2943
#7  0x0000000000cc43c5 in LuaInterface::~LuaInterface() at /tmp/factorio-pQPxC1/src/Script/LuaRemote.hpp:8
#8  0x0000000000dfbee1 in operator() at /usr/include/c++/5/bits/unique_ptr.h:76
#9  0x0000000000e315d3 in std::unique_ptr<LuaInterface, std::default_delete<LuaInterface> >::~unique_ptr() at /usr/include/c++/5/bits/unique_ptr.h:236
#10 0x0000000000e32c6f in destroy<std::unique_ptr<LuaInterface> > at /usr/include/c++/5/ext/new_allocator.h:124
#11 0x0000000000e36fc3 in _S_destroy<std::unique_ptr<LuaInterface> > at /usr/include/c++/5/bits/alloc_traits.h:285
#12 0x0000000000ea5fd6 in destroy<std::unique_ptr<LuaInterface> > at /usr/include/c++/5/bits/alloc_traits.h:414
#13 0x00007f49ec7a33f1 in _M_destroy_node at /usr/include/c++/5/bits/stl_tree.h:553
#14 0x000000000040aae9 in _M_drop_node at /usr/include/c++/5/bits/stl_tree.h:561
 521.082 Error CrashHandler.cpp:106: Map tick at moment of crash: 59


Re: [0.15.9] LuaRemote freezes game completely

Posted: Tue May 09, 2017 3:03 pm
by folk
Now suddenly it works when I menu-Restart the level, but when I do menu-Quit it locks the process entirely.
It's not spinning the CPU; usage stays between 1.3-2.5% CPU while locked.

EDIT: Updated folk-shuttle zip with the other errors from the initial post here fixed: https://cdn.discordapp.com/attachments/ ... 0.1.11.zip

Line 1, 36, and 199-202 all contain references to the |ev| variable and need to be commented/uncommented for testing.

Re: [0.15.9] LuaRemote freezes game completely

Posted: Tue May 09, 2017 4:08 pm
by Rseding91
Thanks for the report. This is fixed for the next version of 0.15.