rhotator crash #6502

Open
opened 2024-03-16 10:10:26 +00:00 by whosit · 7 comments
Member
2024-03-16 09:46:03: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '' in callback item_OnPlace(): ...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:120: bad argument #1 to 'hud_get' (number expected, got nil)
2024-03-16 09:46:03: ERROR[Main]: stack traceback:
2024-03-16 09:46:03: ERROR[Main]: [C]: in function 'hud_get'
2024-03-16 09:46:03: ERROR[Main]: ...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:120: in function 'notify'
2024-03-16 09:46:03: ERROR[Main]: /home/mt/5.7.0/Minetest_live/bin/../mods/rhotator/init.lua:690: in function 'copy_rotation_callback'
2024-03-16 09:46:03: ERROR[Main]: /home/mt/5.7.0/Minetest_live/bin/../mods/rhotator/init.lua:485: in function 'func'
2024-03-16 09:46:03: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:108: in function 'callback'
2024-03-16 09:46:03: ERROR[Main]: /home/mt/5.7.0/Minetest_live/bin/../builtin/game/item.lua:285: in function 'on_place'
2024-03-16 09:46:03: ERROR[Main]: ...mt/5.7.0/Minetest_live/bin/../mods/replacer/replacer.lua:214: in function 'replace_single_node'
2024-03-16 09:46:03: ERROR[Main]: ...mt/5.7.0/Minetest_live/bin/../mods/replacer/replacer.lua:307: in function <...mt/5.7.0/Minetest_live/bin/../mods/replacer/replacer.lua:252>
```prolog 2024-03-16 09:46:03: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '' in callback item_OnPlace(): ...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:120: bad argument #1 to 'hud_get' (number expected, got nil) 2024-03-16 09:46:03: ERROR[Main]: stack traceback: 2024-03-16 09:46:03: ERROR[Main]: [C]: in function 'hud_get' 2024-03-16 09:46:03: ERROR[Main]: ...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:120: in function 'notify' 2024-03-16 09:46:03: ERROR[Main]: /home/mt/5.7.0/Minetest_live/bin/../mods/rhotator/init.lua:690: in function 'copy_rotation_callback' 2024-03-16 09:46:03: ERROR[Main]: /home/mt/5.7.0/Minetest_live/bin/../mods/rhotator/init.lua:485: in function 'func' 2024-03-16 09:46:03: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:108: in function 'callback' 2024-03-16 09:46:03: ERROR[Main]: /home/mt/5.7.0/Minetest_live/bin/../builtin/game/item.lua:285: in function 'on_place' 2024-03-16 09:46:03: ERROR[Main]: ...mt/5.7.0/Minetest_live/bin/../mods/replacer/replacer.lua:214: in function 'replace_single_node' 2024-03-16 09:46:03: ERROR[Main]: ...mt/5.7.0/Minetest_live/bin/../mods/replacer/replacer.lua:307: in function <...mt/5.7.0/Minetest_live/bin/../mods/replacer/replacer.lua:252> ```
whosit added the
1. kind/bug
3. source/mod upstream
labels 2024-03-16 10:10:38 +00:00
Author
Member
hud_add(hud definition): add a HUD element described by HUD def, returns ID number on success

meaning, it can fail and returned ID needs to be checked

opened upstream issue:
https://github.com/SwissalpS/replacer/issues/52 wrong repo, it's not replacer, it's rhotator!

``` hud_add(hud definition): add a HUD element described by HUD def, returns ID number on success ``` meaning, it can fail and returned ID needs to be checked opened upstream issue: ~~https://github.com/SwissalpS/replacer/issues/52~~ wrong repo, it's not replacer, it's rhotator!
Author
Member

Did we run out of HUD ids?!

They are stored in std::vector<HudElement *> hud; per-player.
and hud_add() checks if ID of the new element does not fit into u32 (addHud also seems to re-use freed ids):

// hud_add(self, form)
int LuaLocalPlayer::l_hud_add(lua_State *L)
{
	LocalPlayer *player = getobject(L, 1);

	HudElement *elem = new HudElement;
	read_hud_element(L, elem);

	u32 id = player->addHud(elem);
	if (id == U32_MAX) {
		delete elem;
		return 0;
	}
	lua_pushnumber(L, id);
	return 1;
}

I guess we can't exclude possibility of some mod leaking HUDs...

It could be any other mod besides replacer, so we need to find the player who used the replacer when server has crashed and then try to figure out what they were doing that could've created HUDs in excess.

~~Did we run out of HUD ids?!~~ They are stored in `std::vector<HudElement *> hud;` per-player. and `hud_add()` checks if ID of the new element does not fit into `u32` (`addHud` also seems to re-use freed ids): ```c++ // hud_add(self, form) int LuaLocalPlayer::l_hud_add(lua_State *L) { LocalPlayer *player = getobject(L, 1); HudElement *elem = new HudElement; read_hud_element(L, elem); u32 id = player->addHud(elem); if (id == U32_MAX) { delete elem; return 0; } lua_pushnumber(L, id); return 1; } ``` ~~I guess we can't exclude possibility of some mod leaking HUDs...~~ ~~It could be any other mod besides replacer, so we need to find the player who used the replacer when server has crashed and then try to figure out what they were doing that could've created HUDs in excess.~~
2024-03-16 16:15:44: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'moretrees' in callback item_OnPlace(): ...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:120: bad argument #1 to 'hud_get' (number expected, got nil)
2024-03-16 16:15:44: ERROR[Main]: stack traceback:
2024-03-16 16:15:44: ERROR[Main]: 	[C]: in function 'hud_get'
2024-03-16 16:15:44: ERROR[Main]: 	...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:120: in function 'notify'
2024-03-16 16:15:44: ERROR[Main]: 	...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:80: in function 'warning'
2024-03-16 16:15:44: ERROR[Main]: 	/home/mt/5.7.0/Minetest_live/bin/../mods/rhotator/init.lua:684: in function 'copy_rotation_callback'
2024-03-16 16:15:44: ERROR[Main]: 	/home/mt/5.7.0/Minetest_live/bin/../mods/rhotator/init.lua:485: in function 'func'
2024-03-16 16:15:44: ERROR[Main]: 	...inetest_live/bin/../builtin/profiler/instrumentation.lua:108: in function 'callback'
2024-03-16 16:15:44: ERROR[Main]: 	...t_live/bin/../games/minetest_game/mods/default/trees.lua:594: in function 'sapling_on_place'
2024-03-16 16:15:44: ERROR[Main]: 	.../5.7.0/Minetest_live/bin/../mods/moretrees/node_defs.lua:444: in function <.../5.7.0/Minetest_live/bin/../mods/moretrees/node_defs.lua:443>
``` 2024-03-16 16:15:44: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'moretrees' in callback item_OnPlace(): ...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:120: bad argument #1 to 'hud_get' (number expected, got nil) 2024-03-16 16:15:44: ERROR[Main]: stack traceback: 2024-03-16 16:15:44: ERROR[Main]: [C]: in function 'hud_get' 2024-03-16 16:15:44: ERROR[Main]: ...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:120: in function 'notify' 2024-03-16 16:15:44: ERROR[Main]: ...e/mt/5.7.0/Minetest_live/bin/../mods/rhotator/notify.lua:80: in function 'warning' 2024-03-16 16:15:44: ERROR[Main]: /home/mt/5.7.0/Minetest_live/bin/../mods/rhotator/init.lua:684: in function 'copy_rotation_callback' 2024-03-16 16:15:44: ERROR[Main]: /home/mt/5.7.0/Minetest_live/bin/../mods/rhotator/init.lua:485: in function 'func' 2024-03-16 16:15:44: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:108: in function 'callback' 2024-03-16 16:15:44: ERROR[Main]: ...t_live/bin/../games/minetest_game/mods/default/trees.lua:594: in function 'sapling_on_place' 2024-03-16 16:15:44: ERROR[Main]: .../5.7.0/Minetest_live/bin/../mods/moretrees/node_defs.lua:444: in function <.../5.7.0/Minetest_live/bin/../mods/moretrees/node_defs.lua:443> ```
Member

And in the log is no coord where?

And in the log is no coord where?
whosit changed title from replacer crash to rhotator crash 2024-03-16 19:41:36 +00:00
Author
Member

rhotator has a "memory" function that tries to rotate blocks after placement even if you place them by hand or with a replacer...

`rhotator` has a "memory" function that tries to rotate blocks after placement even if you place them by hand or with a replacer...
Author
Member

This crash seems to be fixed upstream:
3b29e5f438

And we have merged it... does it not work?

UPD:
seems like needs to guard other place too..

Something weird is going on there.

~~This crash seems to be fixed upstream:~~ https://github.com/entuland/rhotator/commit/3b29e5f4384ab75b2f4f9f97c3008d997fbed6ad ~~And we have merged it... does it not work?~~ UPD: seems like needs to guard other place too.. Something weird is going on there.
Member

meaning, it can fail and returned ID needs to be checked
...
seems like needs to guard other place too..

i can't remember if used to know this and just forgot, but all my hud management stuff seems to already makes sure the id is defined before trying to get the hud definition (and then validates it further before making any changes). sometimes minetest's API makes it really easy for things to fail and mess up other code's logic - HUD management is one of the worst examples.

> meaning, it can fail and returned ID needs to be checked ... > seems like needs to guard other place too.. i can't remember if used to know this and just forgot, but all my hud management stuff seems to already makes sure the id is defined before trying to get the hud definition (and then validates it further before making any changes). sometimes minetest's API makes it really easy for things to fail and mess up other code's logic - HUD management is one of the worst examples.
AliasAlreadyTaken added the
2. prio/critical
label 2024-03-18 15:42:00 +00:00
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#6502
No description provided.