AsyncErr: Expecting itemstack, itemstring, table or nil. item=farming:raspberries #492

Closed
opened 2021-04-25 02:01:55 +00:00 by AliasAlreadyTaken · 25 comments

Some time ago I had an error reading

2020-12-22 12:55:24: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:carrot

Unfortunately I don't know what exactly the player did. There are carrot related lines in the log the minutes before, so at least someone had probably carrots in their hands:

2020-12-22 12:51:11: ACTION[Server]: A uses farming:carrot, pointing at [nothing]
2020-12-22 12:51:30: ACTION[Server]: B uses farming:carrot, pointing at [node under=2036,-774,1196 above=2036,-774,1197]
2020-12-22 12:51:53: ACTION[Server]: B uses farming:carrot, pointing at [node under=2034,-776,1197 above=2035,-776,1197]
2020-12-22 12:52:57: ACTION[Server]: B uses farming:carrot, pointing at [nothing]
2020-12-22 12:53:42: ACTION[Server]: C uses farming:carrot, pointing at [node under=1985,30,1184 above=1985,31,1184]
2020-12-22 12:53:44: ACTION[Server]: C uses farming:carrot, pointing at [node under=1985,30,1184 above=1985,31,1184]
2020-12-22 12:53:52: ACTION[Server]: C uses farming:carrot, pointing at [nothing]
2020-12-22 12:54:33: ACTION[Server]: B uses farming:carrot, pointing at [node under=2056,-791,1231 above=2056,-790,1231]
2020-12-22 12:55:24: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:carrot

Noone could make heads or tails of it and I forgot about it. May have been a special breed of carrots. Yesterday, it happened again, rapsberries this time. No player claimed they had done anything relating to raspberries.

2021-04-24 14:42:19: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:raspberries

How can I keep carrots and raspberries from rebelling?

https://forum.minetest.net/viewtopic.php?p=394145#p394145

Some time ago I had an error reading ``` 2020-12-22 12:55:24: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:carrot ``` Unfortunately I don't know what exactly the player did. There are carrot related lines in the log the minutes before, so at least someone had probably carrots in their hands: ``` 2020-12-22 12:51:11: ACTION[Server]: A uses farming:carrot, pointing at [nothing] 2020-12-22 12:51:30: ACTION[Server]: B uses farming:carrot, pointing at [node under=2036,-774,1196 above=2036,-774,1197] 2020-12-22 12:51:53: ACTION[Server]: B uses farming:carrot, pointing at [node under=2034,-776,1197 above=2035,-776,1197] 2020-12-22 12:52:57: ACTION[Server]: B uses farming:carrot, pointing at [nothing] 2020-12-22 12:53:42: ACTION[Server]: C uses farming:carrot, pointing at [node under=1985,30,1184 above=1985,31,1184] 2020-12-22 12:53:44: ACTION[Server]: C uses farming:carrot, pointing at [node under=1985,30,1184 above=1985,31,1184] 2020-12-22 12:53:52: ACTION[Server]: C uses farming:carrot, pointing at [nothing] 2020-12-22 12:54:33: ACTION[Server]: B uses farming:carrot, pointing at [node under=2056,-791,1231 above=2056,-790,1231] 2020-12-22 12:55:24: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:carrot ``` Noone could make heads or tails of it and I forgot about it. May have been a special breed of carrots. Yesterday, it happened again, rapsberries this time. No player claimed they had done anything relating to raspberries. ``` 2021-04-24 14:42:19: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:raspberries ``` How can I keep carrots and raspberries from rebelling? https://forum.minetest.net/viewtopic.php?p=394145#p394145
AliasAlreadyTaken added the
1. kind/bug
2. prio/critical
3. source/mod upstream
labels 2021-04-25 02:03:19 +00:00
Member

Maybe what type of block at those coords can give a clue? Flowerpot or something?

Maybe what type of block at those coords can give a clue? Flowerpot or something?
Author
Owner

2021-09-27 04:17:36: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:seed_wheat
2021-09-29 09:52:04: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:carrot
2021-10-31 01:58:18: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:potato

2021-09-27 04:17:36: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:seed_wheat 2021-09-29 09:52:04: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:carrot 2021-10-31 01:58:18: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:potato
Author
Owner

2022-01-08 10:53:48: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:carrot

2022-01-08 10:53:48: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:carrot

any infos about a player you could ask or coords to check what nodes are there?

any infos about a player you could ask or coords to check what nodes are there?
Author
Owner

2022-02-26 22:45:32: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:pea_pod

2022-02-26 22:45:32: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Expecting itemstack, itemstring, table or nil. item=farming:pea_pod
Member

Created a new PR for adding extra info for this (the old one somehow got into a weird state)

your-land/minetest#2

Created a new PR for adding extra info for this (the old one somehow got into a weird state) https://gitea.your-land.de/your-land/minetest/pulls/2
Member

The trigger is a flowerpot:empty, in a protected area, with e.g. a carrot in hand, while not having protection_bypass.

I thought it might have something to do w/ the flowerput possibly having been placed w/ worldedit or via a schematic, but that doesn't seem to be the case.

The trigger is a `flowerpot:empty`, in a protected area, with e.g. a carrot in hand, while not having `protection_bypass`. I thought it might have something to do w/ the flowerput possibly having been placed w/ worldedit or via a schematic, but that doesn't seem to be the case.
AliasAlreadyTaken added this to the 1.1.109 milestone 2022-04-15 00:15:28 +00:00
AliasAlreadyTaken modified the milestone from 1.1.109 to 1.1.110 2022-04-15 00:15:37 +00:00
Author
Owner

Finally a solution.

Aleks555 found a repro: #1760

flux fixed it here: https://github.com/minetest-mods/flowerpot/pull/13

Finally a solution. Aleks555 found a repro: #1760 flux fixed it here: https://github.com/minetest-mods/flowerpot/pull/13
Member

There was technically a second trigger for the same behavior, which was if any player right-clicked an empty flower pot while holding an unknown item.

There was technically a second trigger for the same behavior, which was if *any* player right-clicked an empty flower pot while holding an unknown item.

great timing, didnt phillip trade his now unknown item flight potion today? I think he wanted to keep it to put it into an itemframe 😆

great timing, didnt phillip trade his now unknown item flight potion today? I think he wanted to keep it to put it into an itemframe 😆
Member

@AliasAlreadyTaken we aren't done with this yet, I can't replicate the crash running only default_game, it's gotta be in connection w/ another mod. Possibly, other code could generate the same crash. Doubt I'll track it down tonight.

@AliasAlreadyTaken we aren't done with this yet, I can't replicate the crash running only `default_game`, it's gotta be in connection w/ another mod. Possibly, other code could generate the same crash. Doubt I'll track it down tonight.
AliasAlreadyTaken added the
3. source/integration
label 2022-04-15 06:04:38 +00:00
Author
Owner

After disabling all of the yl mods and half of the others, at least the error message changed:

2022-04-15 10:03:40: ERROR[Main]: ServerError: AsyncErr: Lua: item_OnPlace: Expecting itemstack, itemstring, table or nil. item=farming:carrot

After disabling all of the yl mods and half of the others, at least the error message changed: 2022-04-15 10:03:40: ERROR[Main]: ServerError: AsyncErr: Lua: item_OnPlace: Expecting itemstack, itemstring, table or nil. item=farming:carrot
Author
Owner

{
"areas",
"beds",
"binoculars",
"boats",
"bones",
"bucket",
"butterflies",
"carts",
"creative",
"default",
"doors",
"dungeon_loot",
"dye",
"env_sounds",
"farming",
"fire",
"fireflies",
"flowerpot",
"flowers",
"game_commands",
"give_initial_stuff",
"intllib",
"keys",
"map",
"mtg_craftguide",
"player_api",
"screwdriver",
"sethome",
"sfinv",
"spawn",
"stairs",
"tnt",
"vessels",
"walls",
"weather",
"wool",
"worldedit",
"worldedit_commands",
"worldedit_shortcommands",
"xpanes",
"yl_npc",
"yl_tools"
}

{ "areas", "beds", "binoculars", "boats", "bones", "bucket", "butterflies", "carts", "creative", "default", "doors", "dungeon_loot", "dye", "env_sounds", "farming", "fire", "fireflies", "flowerpot", "flowers", "game_commands", "give_initial_stuff", "intllib", "keys", "map", "mtg_craftguide", "player_api", "screwdriver", "sethome", "sfinv", "spawn", "stairs", "tnt", "vessels", "walls", "weather", "wool", "worldedit", "worldedit_commands", "worldedit_shortcommands", "xpanes", "yl_npc", "yl_tools" }
Author
Owner

areas and flowerpot need to be in for the repro, worldedit to read out stuff.

flowerpot has no dependency to biome_lib, but stops loading when biome lib is not present. Why?

name = flowerpot
depends = default
optional_depends = moretrees, dryplants, poisonivy, farming, flowers
description = A stylish flowerpot that can contain most plants.

areas and flowerpot need to be in for the repro, worldedit to read out stuff. flowerpot has no dependency to biome_lib, but stops loading when biome lib is not present. Why? name = flowerpot depends = default optional_depends = moretrees, dryplants, poisonivy, farming, flowers description = A stylish flowerpot that can contain most plants.

After disabling all of the yl mods and half of the others, at least the error message changed:

2022-04-15 10:03:40: ERROR[Main]: ServerError: AsyncErr: Lua: item_OnPlace: Expecting itemstack, itemstring, table or nil. item=farming:carrot

Attached my test mod "doomcarrot"
Can crash the protected flowerpot, protected flowerpot + flux fix and pure MTG just by placing it because it returns the unexpected true at on_place.

minetest.register_node("doomcarrot:no_place", {
    description = "doomcarrot without on_place",
    tiles = {"doomcarrot.png"},
    is_ground_content = true,
    groups = {}
})


minetest.register_node("doomcarrot:on_place", {
    description = "doomcarrot with on_place",
    tiles = {"doomcarrot.png"},
    is_ground_content = true,
	on_place = function(itemstack, placer, pointed_thing)
		--return itemstack  --doesnt crash 
		return true -- crashes with AsyncErr: Lua: item_OnPlace: Expecting itemstack, itemstring, table or nil. item=doomcarrot:on_place
		end,
    groups = {}
})

So far I found those combinations

  • mod with a node that returns an unexpected on_place value
  • mod with on_rightclick that returns an unexpected value if it gets rightclicked by a node with on_place
  • mod with on_rightclick that gets rightclicked by a node with on_place that returns an unexpected value on_place value
> After disabling all of the yl mods and half of the others, at least the error message changed: > > 2022-04-15 10:03:40: ERROR[Main]: ServerError: AsyncErr: Lua: item_OnPlace: Expecting itemstack, itemstring, table or nil. item=farming:carrot > Attached my test mod "doomcarrot" Can crash the protected flowerpot, protected flowerpot + flux fix and pure MTG just by placing it because it returns the unexpected true at on_place. ```lua minetest.register_node("doomcarrot:no_place", { description = "doomcarrot without on_place", tiles = {"doomcarrot.png"}, is_ground_content = true, groups = {} }) minetest.register_node("doomcarrot:on_place", { description = "doomcarrot with on_place", tiles = {"doomcarrot.png"}, is_ground_content = true, on_place = function(itemstack, placer, pointed_thing) --return itemstack --doesnt crash return true -- crashes with AsyncErr: Lua: item_OnPlace: Expecting itemstack, itemstring, table or nil. item=doomcarrot:on_place end, groups = {} }) ``` So far I found those combinations - mod with a node that returns an unexpected on_place value - mod with on_rightclick that returns an unexpected value if it gets rightclicked by a node with on_place - mod with on_rightclick that gets rightclicked by a node with on_place that returns an unexpected value on_place value
Member

flowerpot has no dependency to biome_lib, but stops loading when biome lib is not present. Why?
optional_depends = moretrees, dryplants, poisonivy, farming, flowers

moretrees, dryplants, and poisonivy depend on biome_lib. minetest's mod dependency resolution is a bit screwy - if an optional_depend is present but can't be loaded, the mod fails to load. the solution is to make sure moretrees, dryplants, and poisonivy are also removed.

> flowerpot has no dependency to biome_lib, but stops loading when biome lib is not present. Why? > optional_depends = moretrees, dryplants, poisonivy, farming, flowers moretrees, dryplants, and poisonivy depend on biome_lib. minetest's mod dependency resolution is a bit screwy - if an optional_depend is present but can't be loaded, the mod fails to load. the solution is to make sure moretrees, dryplants, and poisonivy are also removed.
Member

@Bla interesting, that's certainly related, but not the same behavior that's crashing the flowerpot. this is the code that i've been using to test the crashy behavior we're seeing:

minetest.register_node("test:test", {
    on_rightclick = function()
        return false
    end
})
@Bla interesting, that's certainly related, but not the same behavior that's crashing the flowerpot. this is the code that i've been using to test the crashy behavior we're seeing: ```lua minetest.register_node("test:test", { on_rightclick = function() return false end }) ```

@Bla interesting, that's certainly related, but not the same behavior that's crashing the flowerpot. this is the code that i've been using to test the crashy behavior we're seeing:

@flux that was a reply to Alias post about the changed error code he got I just forgot to quote but added it now per edit.

> @Bla interesting, that's certainly related, but not the same behavior that's crashing the flowerpot. this is the code that i've been using to test the crashy behavior we're seeing: > @flux that was a reply to Alias post about the changed error code he got I just forgot to quote but added it now per edit.
Author
Owner
  1. There's no way we can detect such a construction in the code automatically. We'd have to go through each and every on_rightclick. Can we automatically execut each on_rightclick of every node, entity and whatever else there is? Yes, we can, but we can't guess each path that might lead to a return without xy-ing the test.

  2. What is "false" supposed to mean in this case anyways? I assume the modmaker wanted to say "nil", but since nil is evil they went with false?

  3. After all, this is IMO an engine bug or at least something that needs to be handled in the engine. No need to silently remove the false and insert a nil instead, but at least failing with a less incredibly unhelpful message would be nice. Is there a technical reason why MT doesn't say which node is involved or what position or what player?

1. There's no way we can detect such a construction in the code automatically. We'd have to go through each and every on_rightclick. Can we automatically execut each on_rightclick of every node, entity and whatever else there is? Yes, we can, but we can't guess each path that might lead to a return without xy-ing the test. 2. What is "false" supposed to mean in this case anyways? I assume the modmaker wanted to say "nil", but since nil is evil they went with false? 3. After all, this is IMO an engine bug or at least something that needs to be handled in the engine. No need to silently remove the false and insert a nil instead, but at least failing with a less `incredibly unhelpful message` would be nice. Is there a technical reason why MT doesn't say which node is involved or what position or what player?
  1. There's no way we can detect such a construction in the code automatically. We'd have to go through each and every on_rightclick. Can we automatically execut each on_rightclick of every node, entity and whatever else there is? Yes, we can, but we can't guess each path that might lead to a return without xy-ing the test.

No, Im pretty sure that can happen for alot of the on_ events not just rightclick & place and you would also need to recheck with every mod update.

  1. What is "false" supposed to mean in this case anyways? I assume the modmaker wanted to say "nil", but since nil is evil they went with false?

I guess its more convinient to read, like I used true as value for the doomcarrot because the crash happens at that point

  1. After all, this is IMO an engine bug or at least something that needs to be handled in the engine. No need to silently remove the false and insert a nil instead, but at least failing with a less incredibly unhelpful message would be nice.

the expected return values are not even documented in lua_api.txt.
Was curious what happens if you return nil, on_place does nothing not even crash.

> 1. There's no way we can detect such a construction in the code automatically. We'd have to go through each and every on_rightclick. Can we automatically execut each on_rightclick of every node, entity and whatever else there is? Yes, we can, but we can't guess each path that might lead to a return without xy-ing the test. > No, Im pretty sure that can happen for alot of the on_ events not just rightclick & place and you would also need to recheck with every mod update. > 2. What is "false" supposed to mean in this case anyways? I assume the modmaker wanted to say "nil", but since nil is evil they went with false? > I guess its more convinient to read, like I used true as value for the doomcarrot because the crash happens at that point > 3. After all, this is IMO an engine bug or at least something that needs to be handled in the engine. No need to silently remove the false and insert a nil instead, but at least failing with a less `incredibly unhelpful message` would be nice. > > the expected return values are not even documented in lua_api.txt. Was curious what happens if you return nil, on_place does nothing not even crash.
Author
Owner

temporary fix until flux PR is accepted upstream: 2691bd83e1

flux PR upstream:
https://github.com/minetest-mods/flowerpot/pull/13

temporary fix until flux PR is accepted upstream: https://gitea.your-land.de/your-land/flowerpot/commit/2691bd83e12cd9f760eaf47e1cc8e12f3ab113dd flux PR upstream: https://github.com/minetest-mods/flowerpot/pull/13
Member

Upstream PR got merged, though I still want to spend some more time figuring out the exact locus of the crash

Upstream PR got merged, though I still want to spend some more time figuring out the exact locus of the crash
Author
Owner

Heh, even before I could ship the replacement!

Nice, I'll remove the replacement and use default again.

That's incredibly fast for minetest.

I agree, there needs to be some more research, I'd like to know why it doesn't happen when you grab flowerpot from CDB and use it in MTG without any other mod. There needs to be some other influence, but so far my tests were inconclusive.

Heh, even before I could ship the replacement! Nice, I'll remove the replacement and use default again. That's incredibly fast for minetest. I agree, there needs to be *some* more research, I'd like to know why it doesn't happen when you grab flowerpot from CDB and use it in MTG without any other mod. There needs to be some other influence, but so far my tests were inconclusive.
Member

Alright, convinced myself there isn't another real "part" to this bug. What's going on w/ e.g. a carrot, is in the carrot's on_place logic, if the carrot can't be planted, it invokes the pointed_thing's on_rightclick action, if there is one, and returns the result.

Upstream engine bug should say, "returning invalid values from on_place and the like should give a more meaningful error message".

Alright, convinced myself there isn't another real "part" to this bug. What's going on w/ e.g. a carrot, is in the carrot's `on_place` logic, if the carrot can't be planted, it invokes the `pointed_thing`'s `on_rightclick` action, if there is one, and returns the result. Upstream engine bug should say, "returning invalid values from `on_place` and the like should give a more meaningful error message".
Author
Owner

Sounds like its fixed. I'll close until it happens again.

Sounds like its fixed. I'll close until it happens again.
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: your-land/bugtracker#492
No description provided.