crash when failing to create an entity
fluxionary opened this issue · comments
2023-06-26 10:31:10: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'pipeworks' in callback environment_Step(): .../5.7.0/Minetest_live/bin/../mods/pipeworks/luaentity.lua:166: attempt to index a nil value
2023-06-26 10:31:10: ERROR[Main]: stack traceback:
2023-06-26 10:31:10: ERROR[Main]: .../5.7.0/Minetest_live/bin/../mods/pipeworks/luaentity.lua:166: in function '_add_attached'
2023-06-26 10:31:10: ERROR[Main]: .../5.7.0/Minetest_live/bin/../mods/pipeworks/luaentity.lua:203: in function '_add_loaded'
2023-06-26 10:31:10: ERROR[Main]: .../5.7.0/Minetest_live/bin/../mods/pipeworks/luaentity.lua:377: in function 'move_entities_globalstep_part2'
2023-06-26 10:31:10: ERROR[Main]: .../5.7.0/Minetest_live/bin/../mods/pipeworks/luaentity.lua:409: in function 'func'
2023-06-26 10:31:10: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:108: in function <...inetest_live/bin/../builtin/profiler/instrumentation.lua:101>
2023-06-26 10:31:10: ERROR[Main]: .../mt/5.7.0/Minetest_live/bin/../builtin/game/register.lua:446: in function <.../mt/5.7.0/Minetest_live/bin/../builtin/game/register.lua:432>
Line 166 in ebe2331
minetest.add_entity
can fail. i'm not sure what the correct behavior should be upon such a failure, it seems like this would result in a lost item if i were to just add a nil check and return.
it seems like this would result in a lost item if i were to just add a nil check and return.
it might not (if code is left as is except for nil check and return) but there will be another error latest when trying to remove entity ...
certainly worth mineTESTing :D
Question: how can we provoke it to fail?
Question: how can we provoke it to fail?
i'm not quite sure under what circumstances an entity will fail to get created (too many already in the mapblock? out of available IDs?). but this should probably work for testing, and is easier:
local old_add_entity = minetest.add_entity
function minetest.add_entity(pos, name, staticdata)
if name:match("^pipeworks:") and math.random(10) == 1 then
return
end
return old_add_entity(pos, name, staticdata)
end
Ok im consistently getting what is essentially this error
2023-10-12 12:24:35: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'pipeworks' in callback environment_Step(): /home/minetest/.minetest/mods/pipeworks/luaentity.lua:154: attempt to index a nil value
2023-10-12 12:24:35: ERROR[Main]: stack traceback:
2023-10-12 12:24:35: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:154: in function '_add_attached'
2023-10-12 12:24:35: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:191: in function '_add_loaded'
2023-10-12 12:24:35: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:365: in function 'move_entities_globalstep_part2'
2023-10-12 12:24:35: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:380: in function </home/minetest/.minetest/mods/pipeworks/luaentity.lua:375>
2023-10-12 12:24:35: ERROR[Main]: /usr/share/minetest/builtin/game/register.lua:446: in function </usr/share/minetest/builtin/game/register.lua:432>
its not the same line number but it seems to be the same issue
Ok im consistently getting what is essentially this error
2023-10-12 12:24:35: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'pipeworks' in callback environment_Step(): /home/minetest/.minetest/mods/pipeworks/luaentity.lua:154: attempt to index a nil value 2023-10-12 12:24:35: ERROR[Main]: stack traceback: 2023-10-12 12:24:35: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:154: in function '_add_attached' 2023-10-12 12:24:35: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:191: in function '_add_loaded' 2023-10-12 12:24:35: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:365: in function 'move_entities_globalstep_part2' 2023-10-12 12:24:35: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:380: in function </home/minetest/.minetest/mods/pipeworks/luaentity.lua:375> 2023-10-12 12:24:35: ERROR[Main]: /usr/share/minetest/builtin/game/register.lua:446: in function </usr/share/minetest/builtin/game/register.lua:432>
its not the same line number but it seems to be the same issue
what commit are you? (please update if your not up to date)
original issue was fixed in https://github.com/mt-mods/pipeworks/pull/88/files
Ya i was on an older commit, should have read the changelog before complaining. Thanks!
2023-10-12 21:50:38: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'default' in callback environment_Step(): /home/minetest/.minetest/mods/pipeworks/luaentity.lua:154: attempt to index a nil value
2023-10-12 21:50:38: ERROR[Main]: stack traceback:
2023-10-12 21:50:38: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:154: in function '_add_attached'
2023-10-12 21:50:38: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:191: in function '_add_loaded'
2023-10-12 21:50:38: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:365: in function 'move_entities_globalstep_part2'
2023-10-12 21:50:38: ERROR[Main]: /home/minetest/.minetest/mods/pipeworks/luaentity.lua:380: in function </home/minetest/.minetest/mods/pipeworks/luaentity.lua:375>
2023-10-12 21:50:38: ERROR[Main]: /usr/share/minetest/builtin/game/register.lua:446: in function </usr/share/minetest/builtin/game/register.lua:432>
this was after rm -rf ./pipeworks then git cloning the version as of today ( b6ae50b) then restarting the server.
Minetest: 5.7.0-ppa0~ubuntu22.04.1
Host: Ubuntu 22.04.3 LTS
Can the issue be reopened, or should I make a new one?
Can the issue be reopened, or should I make a new one?
looking stack trace over atm
stack trace doesnt make any sense - https://github.com/mt-mods/pipeworks/blob/master/luaentity.lua#L154 all thats on that line is end
sure you dont have any changes or something?
edit: the stack trace location is the same place you deleted and re cloned pipeworks, correct?
hmmmm, will just reopen for now. can mark this stuff as offtopic later if thats the case, if not the case, better to be in one issue for people reading through rather than hopping around different issues
Something is definitely different or missing from your version, the stacktrace mentions in function '_add_attached'
, that starts on line 157. Also, looking at the code, lines 158 or 159 seem a likely candidate for the error.
Lines 158 to 159 in b6ae50b
ok well ill rm -rf and clone again, i swore i did it right the first time
Ok. seriously for real, close the issue. I have embarrassed myself enough for today. Thank you everyone and sorry to bother