Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

food inside node breaker makes server go kakapuku #20

Open
retsil2 opened this issue Dec 4, 2018 · 3 comments
Open

food inside node breaker makes server go kakapuku #20

retsil2 opened this issue Dec 4, 2018 · 3 comments

Comments

@retsil2
Copy link

retsil2 commented Dec 4, 2018

as lemonfox3008 earlier reported,

I accidently left some food in a node breaker on a server and when it activated via blinky plant the server crashed. I have no access to the error logs but i guess it was because the food was attempted to be "used" and was "eaten" by the machine which could not support it. This is a MAJOR problem as a troublemaker could destroy a server with just a nodebreaker an apple and a blinky plant

we can confirm, this indeed happens. we found out because we have a player who keeps building berry farms, and his pipes go past the sides of nodebreakers, so berries at times enter them and "clog" them, so to speak, which manifests as a crash:

2018-11-30 10:11:26: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'pipeworks' in callback environment_Step(): /home/minetest/minetest/bin/../mods/stamina/init.lua:29: attempt to call method 'get_attribute' (a nil value)
2018-11-30 10:11:26: ERROR[Main]: stack traceback:
2018-11-30 10:11:26: ERROR[Main]:       /home/minetest/minetest/bin/../mods/stamina/init.lua:29: in function 'get_int_attribute'
2018-11-30 10:11:26: ERROR[Main]:       /home/minetest/minetest/bin/../mods/stamina/init.lua:283: in function 'eat'
2018-11-30 10:11:26: ERROR[Main]:       /home/minetest/minetest/bin/../mods/stamina/init.lua:263: in function </home/minetest/minetest/bin/../mods/stamina/init.lua:261>
2018-11-30 10:11:26: ERROR[Main]:       (tail call): ?
2018-11-30 10:11:26: ERROR[Main]:       ...n/../mods/dreambuilder_modpack/pipeworks/wielder.lua:385: in function 'act'
2018-11-30 10:11:26: ERROR[Main]:       ...n/../mods/dreambuilder_modpack/pipeworks/wielder.lua:169: in function 'wielder_on'
2018-11-30 10:11:26: ERROR[Main]:       ...n/../mods/dreambuilder_modpack/pipeworks/wielder.lua:205: in function 'action_on'
2018-11-30 10:11:26: ERROR[Main]:       ...n/../mods/dreambuilder_modpack/mesecons/internal.lua:190: in function '?'
2018-11-30 10:11:26: ERROR[Main]:       ..../mods/dreambuilder_modpack/mesecons/actionqueue.lua:93: in function 'execute'
2018-11-30 10:11:26: ERROR[Main]:       ..../mods/dreambuilder_modpack/mesecons/actionqueue.lua:84: in function '?'
2018-11-30 10:11:26: ERROR[Main]:       ...e/minetest/minetest/bin/../builtin/game/register.lua:412: in function <...e/minetest/minetest/bin/../builtin/game/register.lua:392>
2018-11-30 10:11:26: ERROR[Main]: stack traceback:
@retsil2
Copy link
Author

retsil2 commented Dec 10, 2018

the fake player in pipeworks does not have the requisite method. this quick-and-dirty patch seems to fix it, but we cannot be totally sure it's totally sufficient.

diff --git a/init.lua b/init.lua
index 260cee8..69c0b24 100644
--- a/init.lua
+++ b/init.lua
@@ -26,6 +26,9 @@ SPRINT_JUMP = 0.1             -- how much higher player can jump if satiated
 SPRINT_DRAIN = 0.35            -- how fast to drain satation while sprinting (0-1)
 
 local function get_int_attribute(player, key)
+        if player.get_attribute == nil then
+                return nil
+        end
        local level = player:get_attribute(key)
        if level then
                return tonumber(level)
@@ -35,6 +38,9 @@ local function get_int_attribute(player, key)
 end
 
 local function stamina_update_level(player, level)
+        if player.get_attribute == nil then
+                return nil
+        end
        local old = get_int_attribute(player, "stamina:level")
 
        if level == old then  -- To suppress HUD update

@thomasrudin
Copy link

#21 should fix your issue

@fluxionary
Copy link
Contributor

I can't replicate this issue currently, I believe it has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants