minetest-mods / woodcutting

GNU Lesser General Public License v3.0
7 stars 8 forks source link

woodcutting/init.lua:119: attempt to index local 'nodedef' (a nil value) #8

Open Bastrabun opened 3 years ago

Bastrabun commented 3 years ago

From the log it seems like a moretrees oak was being woodcutted, but in a populated area. Can't say if the block in question really belonged to the oak.

021-02-05 18:48:14: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'woodcutting' in callback environment_Step(): /home/mtlive1/.minetest/mods/woodcutting/init.lua:119: attempt to index local 'nodedef' (a nil value)
2021-02-05 18:48:14: ERROR[Main]: stack traceback:
2021-02-05 18:48:14: ERROR[Main]:   /home/mtlive1/.minetest/mods/woodcutting/init.lua:119: in function 'get_delay_time'
2021-02-05 18:48:14: ERROR[Main]:   /home/mtlive1/.minetest/mods/woodcutting/init.lua:178: in function 'func'
2021-02-05 18:48:14: ERROR[Main]:   ...ive1/5.3.0/Minetest_live/bin/../builtin/common/after.lua:20: in function 'globalstep'
2021-02-05 18:48:14: ERROR[Main]:   ...mtlive1/.minetest/mods/monitoring/builtin/globalstep.lua:32: in function <...mtlive1/.minetest/mods/monitoring/builtin/globalstep.lua:24>
2021-02-05 18:48:14: ERROR[Main]:   ...ve1/5.3.0/Minetest_live/bin/../builtin/game/register.lua:429: in function <...ve1/5.3.0/Minetest_live/bin/../builtin/game/register.lua:413>
2021-02-05 18:48:14: ERROR[Main]: stack traceback:

I added

   if not nodedef then
            minetest.log("error","[#242] woodcutting: "..dump(self.treenodes_hashed[poshash]))
            return 1
    end

right before the line in questions to see whats going on.

For my reference: 242

bell07 commented 3 years ago

@Bastrabun, did you seen whats going on with the added log entry?

Bastrabun commented 3 years ago

Just searched the log for those, and looks like self.treenodes_hashed[poshash] is nil. Over the course of 3 month the error happend 8 times on a busy server. I added now

        if not nodedef then
                minetest.log("error","[#242] woodcutting: "..dump(self.treenodes_hashed[poshash]))
                minetest.log("error","[#242] woodcutting: pos="..dump(pos))
                minetest.log("error","[#242] woodcutting: poshash="..dump(poshash))
                return 1
        end

If you have any other suggestions what I could log additionally, I'd gladly do so?

Bastrabun commented 2 years ago

Here's a collection of incidents and what the log says:

2021-09-19 07:32:16: ERROR[Server]: [#242] woodcutting: nil
2021-09-19 07:32:16: ERROR[Server]: [#242] woodcutting: pos={
2021-09-19 07:32:16: ERROR[Server]: [#242] woodcutting: poshash=1.5185071659597e+14
2021-10-25 06:17:09: ERROR[Server]: [#242] woodcutting: nil
2021-10-25 06:17:09: ERROR[Server]: [#242] woodcutting: pos={
2021-10-25 06:17:09: ERROR[Server]: [#242] woodcutting: poshash=1.0899124325891e+14
2021-10-25 20:38:30: ERROR[Server]: [#242] woodcutting: nil
2021-10-25 20:38:30: ERROR[Server]: [#242] woodcutting: pos={
2021-10-25 20:38:30: ERROR[Server]: [#242] woodcutting: poshash=1.6811146488056e+14
2021-11-26 02:16:49: ERROR[Server]: [#242] woodcutting: nil
2021-11-26 02:16:49: ERROR[Server]: [#242] woodcutting: pos={
2021-11-26 02:16:49: ERROR[Server]: [#242] woodcutting: poshash=1.6531973587543e+14
2021-11-26 02:16:58: ERROR[Server]: [#242] woodcutting: nil
2021-11-26 02:16:58: ERROR[Server]: [#242] woodcutting: pos={
2021-11-26 02:16:58: ERROR[Server]: [#242] woodcutting: poshash=1.6531973594096e+14
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: nil
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: pos={
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: poshash=1.5362024483107e+14
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: nil
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: pos={
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: poshash=1.5362024476553e+14
2021-12-04 18:36:44: ERROR[Server]: [#242] woodcutting: nil
2021-12-04 18:36:44: ERROR[Server]: [#242] woodcutting: pos={
2021-12-04 18:36:44: ERROR[Server]: [#242] woodcutting: poshash=1.5362453973283e+14
2021-12-04 18:36:54: ERROR[Server]: [#242] woodcutting: nil
2021-12-04 18:36:54: ERROR[Server]: [#242] woodcutting: pos={
2021-12-04 18:36:54: ERROR[Server]: [#242] woodcutting: poshash=1.5362453953622e+14
2021-12-04 18:39:21: ERROR[Server]: [#242] woodcutting: nil
2021-12-04 18:39:21: ERROR[Server]: [#242] woodcutting: pos={
2021-12-04 18:39:21: ERROR[Server]: [#242] woodcutting: poshash=1.5362453953622e+14

Here's two events in a row:

2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: nil
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: pos={
    y = 31,
    x = 7005,
    z = 2999
}
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: poshash=1.5362024483107e+14
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: nil
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: pos={
    y = 30,
    x = 7005,
    z = 2999
}
2021-12-04 18:35:03: ERROR[Server]: [#242] woodcutting: poshash=1.5362024476553e+14
bell07 commented 2 years ago

Please try if the last version solves your issue.

Festus1965 commented 2 years ago

confirm crash with Mai 2021 woocutting version

Minetest engine MTG 5.5.0

took newest version now and see if happen again