pandorabox-io / pandorabox.io

Pandorabox infrastructure code
https://pandorabox.io
31 stars 4 forks source link

Light Tower clock crash #383

Closed int-ua closed 4 years ago

int-ua commented 4 years ago

I was rotating a green digital clock with a sonic screwdriver next to a running water tile and a travelnet nearby when the server crashed and it is now crashing each time I try to login.

int-ua commented 4 years ago
AsyncErr: ServerThread::run Lua: Runtime error from mod 'ontime_clocks' in callback LuaABM::trigger():
...9/.minetest/mods/display_modpack/display_api/display.lua:173: attempt to index local 'ov' (a nil value)
stack traceback:
...9/.minetest/mods/display_modpack/display_api/display.lua:173: in function <...9/.minetest/mods/display_modpack/display_api/display.lua:160>
int-ua commented 4 years ago

Should facedir_values[0] at https://github.com/pyrollo/display_modpack/blob/master/display_api/display.lua#L122 be facedir_values[1] maybe?

SwissalpS commented 4 years ago

certainly not lua (index 0)

coil0 commented 4 years ago

facedir_values[0] is defined in this case, so that’s not the reason it returns nil.

int-ua commented 4 years ago

My local server now crashes on login and I'm ready to test your suggestions. Testing 1 first... still nil.

int-ua commented 4 years ago

Change suggested by a92, didn't work:

diff --git a/display_api/display.lua b/display_api/display.lua
index 2fed40f..42a49aa 100644
--- a/display_api/display.lua
+++ b/display_api/display.lua
@@ -116,7 +116,7 @@ local function get_orientation_values(node)
        if paramtype2 == "wallmounted" or paramtype2 == "colorwallmounted" then
            return wallmounted_values[node.param2 % 8]
        elseif paramtype2 == "facedir" or paramtype2 == "colorfacedir"  then
-           return facedir_values[node.param2 % 32]
+           return facedir_values[node.param2 % 24]
        else
            -- No orientation or unknown orientation type
            return facedir_values[0]
OgelGames commented 4 years ago

https://github.com/pyrollo/display_modpack/blob/master/display_api/display.lua#L72

~Seems like this should use ipairs not pairs Same for #L76~

SwissalpS commented 4 years ago

pairs works on lists too, at least those I've tried.

int-ua commented 4 years ago

Seems like this should use ipairs not pairs Same for #L76

didn't work. Please cross out suggestions that didn't work

diff --git a/display_api/display.lua b/display_api/display.lua
index 2fed40f..27ab79c 100644
--- a/display_api/display.lua
+++ b/display_api/display.lua
@@ -69,11 +69,11 @@ local function compute_values(r)
        restricted=(r.x==0 and r.z==0) }
 end

-for i, r in pairs(facedir_rotations) do
+for i, r in ipairs(facedir_rotations) do
    facedir_values[i] = compute_values(r)
 end

-for i, r in pairs(wallmounted_rotations) do
+for i, r in ipairs(wallmounted_rotations) do
    wallmounted_values[i] = compute_values(r)
 end
int-ua commented 4 years ago

paramtype2 is "wallmounted" and

wallmounted_values[node.param2 % 8]

is nil

int-ua commented 4 years ago

With wallmounted_values[node.param2 % 6] (suggested by a92) it loaded but clock display is broken this way.

int-ua commented 4 years ago

Making a PR with this temporary workaround:

diff --git a/display_api/display.lua b/display_api/display.lua
index 2fed40f..dd0b3fc 100644
--- a/display_api/display.lua
+++ b/display_api/display.lua
@@ -114,6 +114,9 @@ local function get_orientation_values(node)
    if ndef then
        local paramtype2 = ndef.paramtype2
        if paramtype2 == "wallmounted" or paramtype2 == "colorwallmounted" then
+           if (wallmounted_values[node.param2 % 8] == nil) then
+               return facedir_values[0]
+           end
            return wallmounted_values[node.param2 % 8]
        elseif paramtype2 == "facedir" or paramtype2 == "colorfacedir"  then
            return facedir_values[node.param2 % 32]
int-ua commented 4 years ago

wait, coil already created https://github.com/pyrollo/display_modpack/pull/37/files

OgelGames commented 4 years ago

So do those PRs fix the crashing on login on your local server @int-ua? If so maybe the display_modpack should be forked temporarily (or use your fork?), so the fix can be applied to the server sooner?

int-ua commented 4 years ago

Yes, I was able to login with my patch, didn't add coil changes though. I'm waiting for it be forked, yes. Can you do that and force server code update?

OgelGames commented 4 years ago

@int-ua does coil's fork also work? https://github.com/coil0/display_modpack/tree/pandorabox I can update it now if it does.

EDIT: going to update to coil's fork now anyway...

OgelGames commented 4 years ago

Didn't mean to close this yet...

OgelGames commented 4 years ago

Ok, just restarted the server, @int-ua try logging in to see if it's fixed.

int-ua commented 4 years ago

Crashing fixed, thank you.

thomasrudin commented 4 years ago

i thought something was wrong when i saw the unread count on my mailbox this morning... Impressive detective work without the logfiles... :open_mouth:

I opened an issue (#384) for that but i'm not sure yet how to publish the logs without some kind of shell acces...

SwissalpS commented 4 years ago

i'm not sure yet how to publish the logs without some kind of shell acces...

Don't, it would take the fun away :p There would be a possibility of the watchdog to copy last x lines of log to a static page. (on start) But I fear that could open another pandoras box. We wouldn't want DMs to appear in public logs.