minetest-mods / skinsdb

Player skin mod, supporting unified_inventory, sfinv and smart_inventory
27 stars 41 forks source link

Fatal crash under unknown circumstances #8

Closed gpcf closed 6 years ago

gpcf commented 6 years ago

Linuxworks server just crashed with this output:

2018-03-01 19:01:53: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback on_joinplayer(): ...mes/minetest-server/.minetest/mods/skinsdb/formspecs.lua:28: attempt to index local 'context' (a nil value)
2018-03-01 19:01:53: ERROR[Main]: stack traceback:
2018-03-01 19:01:53: ERROR[Main]:       ...mes/minetest-server/.minetest/mods/skinsdb/formspecs.lua:28: in function 'get_skin_selection_formspec'
2018-03-01 19:01:53: ERROR[Main]:       ...server/.minetest/mods/skinsdb/unified_inventory_page.lua:20: in function 'get_formspec'
2018-03-01 19:01:53: ERROR[Main]:       ...server/.minetest/mods/skinsdb/unified_inventory_page.lua:26: in function 'get_formspec'
2018-03-01 19:01:53: ERROR[Main]:       ...est-server/.minetest/mods/unified_inventory/internal.lua:84: in function 'get_formspec'
2018-03-01 19:01:53: ERROR[Main]:       ...est-server/.minetest/mods/unified_inventory/internal.lua:263: in function 'set_inventory_formspec'
2018-03-01 19:01:53: ERROR[Main]:       ...est-server/.minetest/mods/unified_inventory/internal.lua:310: in function 'apply_filter'
2018-03-01 19:01:53: ERROR[Main]:       ...st-server/.minetest/mods/unified_inventory/callbacks.lua:20: in function <...st-server/.minetest/mods/unified_inventory/callbacks.lua:12>
2018-03-01 19:01:53: ERROR[Main]:       /usr/local/share/minetest/builtin/game/register.lua:412: in function </usr/local/share/minetest/builtin/game/register.lua:392>
SmallJoker commented 6 years ago

https://github.com/minetest-mods/skinsdb/blob/3abb6aee40dd6159ab4db4c01981e76ef6ad3b90/unified_inventory_page.lua#L17-L22

skins.ui_context is apparently not set for that player name. Either it's a dummy player (name = "") or there's a race of skinsdb to create the table field and u_i to get the formspec. @bell07 Do you have any other ideas what could be the reason for this crash?

bell07 commented 6 years ago

Seems to be a timing issue. unified_inventory/callbacks.lua:20 is the "register_on_joinplayer" from unified_inventory. If this function is called before the skinsdb's register_on_joinplayer, the issue can appear ...

bell07 commented 6 years ago

@SmallJoker , can you please review my fix before I merge them?

bell07 commented 6 years ago

@gpcf, can you pls. provide the full mods list? Maybe it is circuit dependency. PS: the proposed solution should work, but I like to understand the issue in detail