terminate called without an active exception #4306

Closed
opened 2023-04-27 09:49:39 +00:00 by AliasAlreadyTaken · 21 comments

This crashed us the server three times now, all since the 1.1.118 update. There was no timestamp, no nothing around

terminate called without an active exception
This crashed us the server three times now, all since the 1.1.118 update. There was no timestamp, no nothing around ``` terminate called without an active exception ```
AliasAlreadyTaken added the
1. kind/bug
3. source/unknown
labels 2023-04-27 14:18:15 +00:00
Author
Owner

2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:coal_lump" dropped at (2232,-26952,1314) by , 916.49 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 15" dropped at (2246,-26951,1317) by , 850.39 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 3" dropped at (2251,-26949,1324) by , 838.26 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:iron_lump 4" dropped at (2253,-26949,1324) by , 837.89 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tin_lump 2" dropped at (2249,-26951,1316) by , 850.39 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian 22" dropped at (2246,-26947,1340) by , 849.62 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian 3" dropped at (2251,-26948,1330) by , 837.12 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:dirt" dropped at (2249,-26946,1342) by , 849.62 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:copper_lump 3" dropped at (2251,-26948,1330) by , 837.12 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:cobble 27" dropped at (2247,-26946,1337) by , 837.50 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:copper_lump 4" dropped at (2249,-26946,1336) by , 830.82 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:gravel 29" dropped at (2254,-26948,1330) by , 792.38 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:copper_lump" dropped at (2249,-26946,1341) by , 849.48 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:iron_lump 20" dropped at (2251,-26949,1328) by , 830.82 seconds ago
2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] about to remove "default:coal_lump" dropped by
2023-04-27 15:31:17: ACTION[Main]: Server: Shutting down
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:iron_lump 20" dropped at (2251,-26949,1328) by , 831.01 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:copper_lump" dropped at (2249,-26946,1341) by , 849.67 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:gravel 29" dropped at (2254,-26948,1330) by , 792.57 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:copper_lump 4" dropped at (2249,-26946,1336) by , 831.01 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:cobble 27" dropped at (2247,-26946,1337) by , 837.69 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:copper_lump 3" dropped at (2251,-26948,1330) by , 837.31 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:dirt" dropped at (2249,-26946,1342) by , 849.81 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian 3" dropped at (2251,-26948,1330) by , 837.31 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian 22" dropped at (2246,-26947,1340) by , 849.81 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:tin_lump 2" dropped at (2249,-26951,1316) by , 850.58 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:iron_lump 4" dropped at (2253,-26949,1324) by , 838.08 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 3" dropped at (2251,-26949,1324) by , 838.45 seconds ago
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 15" dropped at (2246,-26951,1317) by , 850.58 seconds ago
terminate called without an active exception

2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:coal_lump" dropped at (2232,-26952,1314) by <UNKNOWN>, 916.49 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 15" dropped at (2246,-26951,1317) by <UNKNOWN>, 850.39 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 3" dropped at (2251,-26949,1324) by <UNKNOWN>, 838.26 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:iron_lump 4" dropped at (2253,-26949,1324) by <UNKNOWN>, 837.89 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tin_lump 2" dropped at (2249,-26951,1316) by <UNKNOWN>, 850.39 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian 22" dropped at (2246,-26947,1340) by <UNKNOWN>, 849.62 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian 3" dropped at (2251,-26948,1330) by <UNKNOWN>, 837.12 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:dirt" dropped at (2249,-26946,1342) by <UNKNOWN>, 849.62 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:copper_lump 3" dropped at (2251,-26948,1330) by <UNKNOWN>, 837.12 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:cobble 27" dropped at (2247,-26946,1337) by <UNKNOWN>, 837.50 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:copper_lump 4" dropped at (2249,-26946,1336) by <UNKNOWN>, 830.82 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:gravel 29" dropped at (2254,-26948,1330) by <UNKNOWN>, 792.38 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:copper_lump" dropped at (2249,-26946,1341) by <UNKNOWN>, 849.48 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:iron_lump 20" dropped at (2251,-26949,1328) by <UNKNOWN>, 830.82 seconds ago 2023-04-27 15:31:16: ACTION[Server]: [yl_commons] [builtin] about to remove "default:coal_lump" dropped by <UNKNOWN> 2023-04-27 15:31:17: ACTION[Main]: Server: Shutting down 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:iron_lump 20" dropped at (2251,-26949,1328) by <UNKNOWN>, 831.01 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:copper_lump" dropped at (2249,-26946,1341) by <UNKNOWN>, 849.67 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:gravel 29" dropped at (2254,-26948,1330) by <UNKNOWN>, 792.57 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:copper_lump 4" dropped at (2249,-26946,1336) by <UNKNOWN>, 831.01 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:cobble 27" dropped at (2247,-26946,1337) by <UNKNOWN>, 837.69 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:copper_lump 3" dropped at (2251,-26948,1330) by <UNKNOWN>, 837.31 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:dirt" dropped at (2249,-26946,1342) by <UNKNOWN>, 849.81 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian 3" dropped at (2251,-26948,1330) by <UNKNOWN>, 837.31 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian 22" dropped at (2246,-26947,1340) by <UNKNOWN>, 849.81 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:tin_lump 2" dropped at (2249,-26951,1316) by <UNKNOWN>, 850.58 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:iron_lump 4" dropped at (2253,-26949,1324) by <UNKNOWN>, 838.08 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 3" dropped at (2251,-26949,1324) by <UNKNOWN>, 838.45 seconds ago 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 15" dropped at (2246,-26951,1317) by <UNKNOWN>, 850.58 seconds ago terminate called without an active exception
AliasAlreadyTaken added the
2. prio/critical
label 2023-04-27 15:46:31 +00:00
Author
Owner

2023-04-27 15:30:05: ACTION[Server]: [yl_commons] lua is using 867.3 MB
2023-04-27 15:30:15: ACTION[Server]: [yl_commons] lua is using 835.2 MB
2023-04-27 15:30:25: ACTION[Server]: [yl_commons] lua is using 787.6 MB
2023-04-27 15:30:35: ACTION[Server]: [yl_commons] lua is using 741.2 MB
2023-04-27 15:30:45: ACTION[Server]: [yl_commons] lua is using 695.5 MB
2023-04-27 15:30:55: ACTION[Server]: [yl_commons] lua is using 601.2 MB
2023-04-27 15:31:05: ACTION[Server]: [yl_commons] lua is using 523.5 MB
2023-04-27 15:31:14: ACTION[Server]: [yl_commons] lua is using 1068.4 MB

2023-04-27 15:30:05: ACTION[Server]: [yl_commons] lua is using 867.3 MB 2023-04-27 15:30:15: ACTION[Server]: [yl_commons] lua is using 835.2 MB 2023-04-27 15:30:25: ACTION[Server]: [yl_commons] lua is using 787.6 MB 2023-04-27 15:30:35: ACTION[Server]: [yl_commons] lua is using 741.2 MB 2023-04-27 15:30:45: ACTION[Server]: [yl_commons] lua is using 695.5 MB 2023-04-27 15:30:55: ACTION[Server]: [yl_commons] lua is using 601.2 MB 2023-04-27 15:31:05: ACTION[Server]: [yl_commons] lua is using 523.5 MB 2023-04-27 15:31:14: ACTION[Server]: [yl_commons] lua is using 1068.4 MB
Author
Owner

Those are the lines and timestamps (of the line before) when the error occurred:

2023-04-25 21:05:26: ACTION[Main]: [yl_commons] [builtin] preparing to unload "nether:rack 2" dropped at (1975,29807,1458) by <UNKNOWN>, 99.69 seconds ago
terminate called without an active exception
--
2023-04-25 21:17:37: ACTION[Main]: [yl_commons] [builtin] preparing to unload "petz:chicken_egg" dropped at (4490,13,308) by <UNKNOWN>, 408.73 seconds ago
terminate called without an active exception
--
2023-04-26 19:56:28: ACTION[Main]: [yl_commons] [builtin] preparing to unload "mobs_animal:rat" dropped at (-17422,85,1542) by <UNKNOWN>, 182.44 seconds ago
terminate called without an active exception
--
2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 15" dropped at (2246,-26951,1317) by <UNKNOWN>, 850.58 seconds ago
terminate called without an active exception
--
2023-04-28 08:50:40: ACTION[Main]: [yl_commons] [builtin] preparing to unload "moretrees:willow_leaves 12" dropped at (-13055,47,12959) by <UNKNOWN>, 847.91 seconds ago
terminate called without an active exception
--
2023-04-28 09:11:06: ACTION[Server]: HorusDamocles leaves game. List of players: 
terminate called without an active exception
--
2023-04-28 09:45:57: ACTION[Main]: [yl_commons] [builtin] preparing to unload "dye:magenta" dropped at (1955,29780,1394) by <UNKNOWN>, 34.11 seconds ago
terminate called without an active exception
--
2023-04-28 12:23:56: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:grass_1" dropped at (27848,24,28654) by <UNKNOWN>, 135.04 seconds ago
terminate called without an active exception

Those are the lines and timestamps (of the line before) when the error occurred: ``` 2023-04-25 21:05:26: ACTION[Main]: [yl_commons] [builtin] preparing to unload "nether:rack 2" dropped at (1975,29807,1458) by <UNKNOWN>, 99.69 seconds ago terminate called without an active exception -- 2023-04-25 21:17:37: ACTION[Main]: [yl_commons] [builtin] preparing to unload "petz:chicken_egg" dropped at (4490,13,308) by <UNKNOWN>, 408.73 seconds ago terminate called without an active exception -- 2023-04-26 19:56:28: ACTION[Main]: [yl_commons] [builtin] preparing to unload "mobs_animal:rat" dropped at (-17422,85,1542) by <UNKNOWN>, 182.44 seconds ago terminate called without an active exception -- 2023-04-27 15:31:17: ACTION[Main]: [yl_commons] [builtin] preparing to unload "caverealms:glow_obsidian_2 15" dropped at (2246,-26951,1317) by <UNKNOWN>, 850.58 seconds ago terminate called without an active exception -- 2023-04-28 08:50:40: ACTION[Main]: [yl_commons] [builtin] preparing to unload "moretrees:willow_leaves 12" dropped at (-13055,47,12959) by <UNKNOWN>, 847.91 seconds ago terminate called without an active exception -- 2023-04-28 09:11:06: ACTION[Server]: HorusDamocles leaves game. List of players: terminate called without an active exception -- 2023-04-28 09:45:57: ACTION[Main]: [yl_commons] [builtin] preparing to unload "dye:magenta" dropped at (1955,29780,1394) by <UNKNOWN>, 34.11 seconds ago terminate called without an active exception -- 2023-04-28 12:23:56: ACTION[Main]: [yl_commons] [builtin] preparing to unload "default:grass_1" dropped at (27848,24,28654) by <UNKNOWN>, 135.04 seconds ago terminate called without an active exception ```
AliasAlreadyTaken added this to the Alias@work project 2023-04-28 13:20:47 +00:00
AliasAlreadyTaken added the
3. source/engine
label 2023-04-28 13:46:09 +00:00
Author
Owner
There are various occurrences in the minetest issues that deal with a similar problem: https://github.com/minetest/minetest/issues?q=terminate+called+without+an+active+exception https://github.com/minetest/minetest/issues/11731 https://github.com/minetest/minetest/issues/1413 https://irc.minetest.net/minetest/2021-02-14
Author
Owner

The IRC link speaks of

"Hi there error: terminate called without an active exception, when copying the minetest.format_chat_message and redefining it."

Do we do that? Yes:

https://github.com/fluxionary/minetest-builtin_overrides/blob/main/fix_capitalization.lua#L35

Is this used anywhere? Yes:

arena_lib/src/chat.lua
arena_lib/src/commands.lua

Is this a new thing that changed between 1.1.117.1 and 1.1.118? Yes. We switched out arena_lib as a whole and started following upstream again.

The IRC link speaks of "Hi there error: terminate called without an active exception, when copying the minetest.format_chat_message and redefining it." Do we do that? Yes: https://github.com/fluxionary/minetest-builtin_overrides/blob/main/fix_capitalization.lua#L35 Is this used anywhere? Yes: arena_lib/src/chat.lua arena_lib/src/commands.lua Is this a new thing that changed between 1.1.117.1 and 1.1.118? Yes. We switched out arena_lib as a whole and started following upstream again.
Author
Owner

There's also someone on discord with a similar problem

GreenXenith — 04/11/2022 04:18

Im trying to debug on_deactivate but its not being consistent
ok yeah
Apparently entity callbacks fail to pass exceptions through or something to that effect

GreenXenith — 04/11/2022 04:25

maybe only during load/unload
or freaking not
only in on_deactivate
I think this is reproducable:

minetest.register_entity("test:entity", {
    initial_properties = {
        visual="sprite",
        textures={"default_dirt.png"},
    },
    on_deactivate = function()
        error("foo")
    end,
})

If you manually deactivate it (punch it), youll get the foo error but also a segfault.
If you leave the game, it will segfault without the foo error

GreenXenith — 04/11/2022 04:34

which is super fun because I was testing the static props by leaving the game so it didnt tell me my boolean concat was invalid
anyway, I digress

Midnight — 04/11/2022 04:38

terminate called without an active exception
Is that what it's giving you too?

GreenXenith — 04/11/2022 04:38

yeah
I think on_deactivate is just buggy in general and I dont trust it >:(

wsor — 04/11/2022 04:39

sourcerykid code i think?

Midnight — 04/11/2022 04:39

I didn't test manually deactivating it, only leaving the game.

Midnight — 04/11/2022 04:40

who?

GreenXenith — 04/11/2022 04:40

it shouldnt segfault either way, but the fact that it doesnt give you lua error output on leave is just misleading 😩

There's also someone on discord with a similar problem ##### GreenXenith — 04/11/2022 04:18 Im trying to debug on_deactivate but its not being consistent ok yeah Apparently entity callbacks fail to pass exceptions through or something to that effect ##### GreenXenith — 04/11/2022 04:25 maybe only during load/unload or freaking not only in on_deactivate I think this is reproducable: ``` minetest.register_entity("test:entity", { initial_properties = { visual="sprite", textures={"default_dirt.png"}, }, on_deactivate = function() error("foo") end, }) ``` If you manually deactivate it (punch it), youll get the foo error but also a segfault. If you leave the game, it will segfault without the foo error ##### GreenXenith — 04/11/2022 04:34 which is super fun because I was testing the static props by leaving the game so it didnt tell me my boolean concat was invalid anyway, I digress ##### Midnight — 04/11/2022 04:38 terminate called without an active exception Is that what it's giving you too? ##### GreenXenith — 04/11/2022 04:38 yeah I think on_deactivate is just buggy in general and I dont trust it >:( ##### wsor — 04/11/2022 04:39 sourcerykid code i think? ##### Midnight — 04/11/2022 04:39 I didn't test manually deactivating it, only leaving the game. ##### Midnight — 04/11/2022 04:40 who? ##### GreenXenith — 04/11/2022 04:40 it shouldnt segfault either way, but the fact that it doesnt give you lua error output on leave is just misleading 😩
Author
Owner

Thank you luatic :D

Suggests to add this PR: https://github.com/minetest/minetest/pull/13468/files

So I did:

void ActiveObjectMgr::clear(const std::function<bool(ServerActiveObject *, u16)> &cb)
{
        //std::vector<u16> objects_to_remove;
        auto cloned_map(m_active_objects);

        for (auto &it : cloned_map) {
                if (cb(it.second, it.first)) {
                        // Id to be removed from m_active_objects
                        //objects_to_remove.push_back(it.first);
                        m_active_objects.erase(it.first);
                }
        }

        // Remove references from m_active_objects
        //for (u16 i : objects_to_remove) {
        //      m_active_objects.erase(i);
        //}
}
Thank you luatic :D Suggests to add this PR: https://github.com/minetest/minetest/pull/13468/files So I did: ```cpp void ActiveObjectMgr::clear(const std::function<bool(ServerActiveObject *, u16)> &cb) { //std::vector<u16> objects_to_remove; auto cloned_map(m_active_objects); for (auto &it : cloned_map) { if (cb(it.second, it.first)) { // Id to be removed from m_active_objects //objects_to_remove.push_back(it.first); m_active_objects.erase(it.first); } } // Remove references from m_active_objects //for (u16 i : objects_to_remove) { // m_active_objects.erase(i); //} } ```
Author
Owner

And another despite the bugfix:

2023-04-29 11:24:53: ACTION[Server]: [yl_commons] formspec "mail:sent": caboy submitted {"filter":"","read":"Read","sortdirection":"1","sortfield":"3"}
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11662,29728,-11662) by <UNKNOWN>, 522.09 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:stone_block" dropped at (11660,29728,-11659) by <UNKNOWN>, 575.63 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tree 5" dropped at (11660,29728,-11659) by <UNKNOWN>, 575.63 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "mobs:meat_raw" dropped at (11660,29728,-11659) by <UNKNOWN>, 575.63 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tree 5" dropped at (11662,29728,-11662) by <UNKNOWN>, 522.09 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:stone_block" dropped at (11662,29728,-11662) by <UNKNOWN>, 522.09 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11660,29728,-11660) by <UNKNOWN>, 551.52 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:stone_block" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tree 5" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tree 3" dropped at (11660,29728,-11660) by <UNKNOWN>, 551.52 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:stone_block" dropped at (11660,29728,-11660) by <UNKNOWN>, 551.52 seconds ago
2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago
2023-04-29 11:24:54: ACTION[Main]: Server: Shutting down
terminate called without an active exception
And another despite the bugfix: ``` 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] formspec "mail:sent": caboy submitted {"filter":"","read":"Read","sortdirection":"1","sortfield":"3"} 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11662,29728,-11662) by <UNKNOWN>, 522.09 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:stone_block" dropped at (11660,29728,-11659) by <UNKNOWN>, 575.63 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tree 5" dropped at (11660,29728,-11659) by <UNKNOWN>, 575.63 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "mobs:meat_raw" dropped at (11660,29728,-11659) by <UNKNOWN>, 575.63 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tree 5" dropped at (11662,29728,-11662) by <UNKNOWN>, 522.09 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:stone_block" dropped at (11662,29728,-11662) by <UNKNOWN>, 522.09 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11660,29728,-11660) by <UNKNOWN>, 551.52 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:stone_block" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tree 5" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:tree 3" dropped at (11660,29728,-11660) by <UNKNOWN>, 551.52 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "default:stone_block" dropped at (11660,29728,-11660) by <UNKNOWN>, 551.52 seconds ago 2023-04-29 11:24:53: ACTION[Server]: [yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago 2023-04-29 11:24:54: ACTION[Main]: Server: Shutting down terminate called without an active exception ```
Author
Owner

Could be coincidence, but I keep seeing those: [yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago every time the server shuts down with this message.

I changed this code recently, did I make a mistake?

93c9ab189e

Could be coincidence, but I keep seeing those: `[yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago` every time the server shuts down with this message. I changed this code recently, did I make a mistake? https://gitea.your-land.de/your-land/yl_commons/commit/93c9ab189e514112516f19ac032617aa1a6c34e7
Member

Could be coincidence, but I keep seeing those: [yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago every time the server shuts down with this message.

2023-04-28 09:11:06: ACTION[Server]: HorusDamocles leaves game. List of players:

these are both expected. as long as the crash isn't too severe, the server will disconnect all players, unload all entities, save the map, etc.. we've added logging about when dropped items are unloaded, hence all the logs about unloading them when the server is shutting down. what would be interesting to see is what appears above those lines.

https://github.com/minetest/minetest/pull/13468 is certainly one locus of bugs like this, the more general issue for discussing places where mods modify objects that c++ expects to have control over them is https://github.com/minetest/minetest/issues/13471

> Could be coincidence, but I keep seeing those: `[yl_commons] [builtin] preparing to unload "rainbow_source:black_water_source" dropped at (11662,29728,-11670) by <UNKNOWN>, 785.36 seconds ago` every time the server shuts down with this message. > 2023-04-28 09:11:06: ACTION[Server]: HorusDamocles leaves game. List of players: these are both *expected*. as long as the crash isn't too severe, the server will disconnect all players, unload all entities, save the map, etc.. we've added logging about when dropped items are unloaded, hence all the logs about unloading them when the server is shutting down. what would be interesting to see is what appears *above* those lines. https://github.com/minetest/minetest/pull/13468 is certainly one locus of bugs like this, the more general issue for discussing places where mods modify objects that c++ expects to have control over them is https://github.com/minetest/minetest/issues/13471
Author
Owner

these are both expected.

Ofc they are expected. What I meant is that the issue happens only after 1.1.118. For this milestone I changed something about the code logging the drops. The code you wrote before (1.1.117.1) for the logging didn't cause the issue. The code I wrote (1.1.118) might.

There were no similarities between all of those crashes in the "actions before", going back to 10 seconds before the crash.

> these are both expected. Ofc they are expected. What I meant is that the issue happens only after 1.1.118. For this milestone I changed something about the code logging the drops. The code you wrote before (1.1.117.1) for the logging didn't cause the issue. The code I wrote (1.1.118) might. There were no similarities between all of those crashes in the "actions before", going back to 10 seconds before the crash.
Member

we changed a lot of things w/ 1.1.118, i suppose it's worth reviewing though.

we changed a lot of things w/ 1.1.118, i suppose it's worth reviewing though.
Member
    local s = self.itemstring
    if not s or s == "" then
        local o = self.object
        local ent = o:get_luaentity()
        if ent then
            s = ent.name or "<UNKNOWN>"
        end
    end

this code has several possible problems and is redundant. for one, self and self.object:get_luaentity() will always be the same table (as long as self.object exists and hasn't been deactivated). self.name will always just be "__builtin:item". self.object should exist, but then again, you're nil-checking it just a few lines above. this code also doesn't guarantee that s isn't nil or "".

reading through the builtin code again, it appears that self.itemstring is always set to "" when the item is about to be removed (before self.object:remove()), which happens when

  • the item's lifespan has expired
  • the dropped item is being merged w/ another nearby dropped item
  • the item is inside of an ignore node (e.g. the code that tries to move items out of a wall has pushed it into an unloaded area)
  • a player picks up the item

also, it seems like this logging code logically belongs in the on_deactivate callback, instead of get_staticdata - that's my fault, i wasn't aware of on_deactivate until recently, though it's been in the engine since 5.4.0.

i'm trying to update this logic according to the issues i've outlined, but at the moment i've found something interesting: the same error:

debug.txt:

2023-05-01 08:59:16: ACTION[Server]: [yl_commons] [builtin] about to remove "moretrees:fir_cone" dropped by <UNKNOWN>
2023-05-01 08:59:16: ACTION[Main]: Server: Shutting down
2023-05-01 08:59:16: ACTION[Server]: [MOD] smart_chat : Module core: *** leaves the World.
2023-05-01 08:59:16: WARNING[Server]: Deprecated call to set_attribute, use MetaDataRef methods instead. (at ...netest/bin/../worlds/your-land/worldmods/party/squad.lua:591)
2023-05-01 08:59:16: WARNING[Server]: Deprecated call to set_attribute, use MetaDataRef methods instead. (at ...inetest/bin/../worlds/your-land/worldmods/party/init.lua:1152)
2023-05-01 08:59:16: WARNING[Server]: Deprecated call to set_attribute, use MetaDataRef methods instead. (at ...inetest/bin/../worlds/your-land/worldmods/party/init.lua:1153)
2023-05-01 08:59:16: ACTION[Server]: flux leaves game. List of players: 
2023-05-01 08:59:16: ACTION[Server]: [yl_commons] [builtin] about to remove "" dropped by <UNKNOWN>

console log:

<WARNING> 2023-05-01 08:59:15: [Server] Undeclared global variable "yl_report" accessed at ...your-land/worldmods/yl_commons/features/who_are_they.lua:36
<ACTION> 2023-05-01 08:59:16: [Server] [yl_commons] [builtin] about to remove "moretrees:fir_cone" dropped by <UNKNOWN>
]terminate called without an active exception
                                             START-YL.sh: line 4: 1792394 Aborted                 (core dumped) ./bin/minetestserver --terminal --worldname your-land --gameid minetest --config ./worlds/your-land/minetest.conf --logfile ./worlds/your-land/debug.txt
```lua local s = self.itemstring if not s or s == "" then local o = self.object local ent = o:get_luaentity() if ent then s = ent.name or "<UNKNOWN>" end end ``` this code has several possible problems and is redundant. for one, `self` and `self.object:get_luaentity()` will always be the same table (as long as `self.object` exists and hasn't been deactivated). `self.name` will always just be `"__builtin:item"`. `self.object` *should* exist, but then again, you're `nil`-checking it just a few lines above. this code also doesn't guarantee that `s` isn't `nil` or `""`. reading through the builtin code again, it appears that `self.itemstring` is always set to `""` when the item is about to be *removed* (before `self.object:remove()`), which happens when * the item's lifespan has expired * the dropped item is being merged w/ another nearby dropped item * the item is inside of an `ignore` node (e.g. the code that tries to move items out of a wall has pushed it into an unloaded area) * a player picks up the item also, it seems like this logging code logically belongs in the `on_deactivate` callback, instead of `get_staticdata` - that's my fault, i wasn't aware of `on_deactivate` until recently, though it's been in the engine since 5.4.0. i'm trying to update this logic according to the issues i've outlined, but at the moment i've found something interesting: the same error: debug.txt: ``` 2023-05-01 08:59:16: ACTION[Server]: [yl_commons] [builtin] about to remove "moretrees:fir_cone" dropped by <UNKNOWN> 2023-05-01 08:59:16: ACTION[Main]: Server: Shutting down 2023-05-01 08:59:16: ACTION[Server]: [MOD] smart_chat : Module core: *** leaves the World. 2023-05-01 08:59:16: WARNING[Server]: Deprecated call to set_attribute, use MetaDataRef methods instead. (at ...netest/bin/../worlds/your-land/worldmods/party/squad.lua:591) 2023-05-01 08:59:16: WARNING[Server]: Deprecated call to set_attribute, use MetaDataRef methods instead. (at ...inetest/bin/../worlds/your-land/worldmods/party/init.lua:1152) 2023-05-01 08:59:16: WARNING[Server]: Deprecated call to set_attribute, use MetaDataRef methods instead. (at ...inetest/bin/../worlds/your-land/worldmods/party/init.lua:1153) 2023-05-01 08:59:16: ACTION[Server]: flux leaves game. List of players: 2023-05-01 08:59:16: ACTION[Server]: [yl_commons] [builtin] about to remove "" dropped by <UNKNOWN> ``` console log: ``` <WARNING> 2023-05-01 08:59:15: [Server] Undeclared global variable "yl_report" accessed at ...your-land/worldmods/yl_commons/features/who_are_they.lua:36 <ACTION> 2023-05-01 08:59:16: [Server] [yl_commons] [builtin] about to remove "moretrees:fir_cone" dropped by <UNKNOWN> ]terminate called without an active exception START-YL.sh: line 4: 1792394 Aborted (core dumped) ./bin/minetestserver --terminal --worldname your-land --gameid minetest --config ./worlds/your-land/minetest.conf --logfile ./worlds/your-land/debug.txt ```
Member

this is the relevant upstream issue https://github.com/minetest/minetest/issues/8352

this is the relevant upstream issue https://github.com/minetest/minetest/issues/8352
Member

i reworked the log_item_despawn logic: 4f132a5958

changes:

  • use on_deactivate instead of get_staticdata, the latter is only used when unloading an item, not when removing it
  • don't emit "unknown" when something isn't know, just don't include that in the log message
  • as the itemstring value will often be "" for "legitimate" reasons when an object is being removed, grab the value of self.object:get_properties().wield_item in those cases
  • log whether an item is being removed vs. just unloaded
  • wrap the logic inside of an xpcall, which will prevent any exceptions from crashing the server w/ an incomprehensible error message

example log messages:

2023-05-01 10:32:22: ACTION[Server]: [yl_commons] [__builtin:item] about to expire "moretrees:fir_cone"
2023-05-01 10:32:22: ACTION[Server]: [yl_commons] [__builtin:item] removing "ghost of \"moretrees:fir_cone\"" dropped @ (-132,25,281) 63657.1s ago
2023-05-01 10:33:56: ACTION[Server]: [yl_commons] [__builtin:item] unloading "moretrees:fir_cone" dropped by flux @ (-100,12,347) 7.6s ago
i reworked the log_item_despawn logic: https://gitea.your-land.de/your-land/yl_commons/commit/4f132a595845052984e7fbd59ee1be5ebc143ddb changes: * use `on_deactivate` instead of `get_staticdata`, the latter is only used when unloading an item, not when removing it * don't emit "unknown" when something isn't know, just don't include that in the log message * as the `itemstring` value will often be `""` for "legitimate" reasons when an object is being removed, grab the value of `self.object:get_properties().wield_item` in those cases * log whether an item is being removed vs. just unloaded * wrap the logic inside of an `xpcall`, which will prevent any exceptions from crashing the server w/ an incomprehensible error message example log messages: ``` 2023-05-01 10:32:22: ACTION[Server]: [yl_commons] [__builtin:item] about to expire "moretrees:fir_cone" 2023-05-01 10:32:22: ACTION[Server]: [yl_commons] [__builtin:item] removing "ghost of \"moretrees:fir_cone\"" dropped @ (-132,25,281) 63657.1s ago 2023-05-01 10:33:56: ACTION[Server]: [yl_commons] [__builtin:item] unloading "moretrees:fir_cone" dropped by flux @ (-100,12,347) 7.6s ago ```
Author
Owner

IMO important enough to warrant an early 1.1.119, wiht all the bugfixes we have so far.

IMO important enough to warrant an early 1.1.119, wiht all the bugfixes we have so far.
AliasAlreadyTaken added this to the 1.1.119 milestone 2023-05-01 18:25:08 +00:00
Author
Owner

Do we have a repro for testing purposes?

Do we have a repro for testing purposes?
AliasAlreadyTaken added the
4. step/question
label 2023-05-07 19:25:42 +00:00
Member

Do we have a repro for testing purposes?

hmm. i can generate same the error, but i'm not 100% certain why it was occurring before. the issue is that an exception happens inside on_deactivate or get_staticdata - we don't even know if the modifications to the builtin dropped items is the issue. we don't know what entity is triggering this, because the engine logging is terrible. i outlined a few possible causes but i never observed them in my own testing, i had to manually trigger the issue by e.g. using error() inside those callbacks.

> Do we have a repro for testing purposes? hmm. i can generate same the error, but i'm not 100% certain why it was occurring before. the issue is that an exception happens inside `on_deactivate` or `get_staticdata` - we don't even know if the modifications to the builtin dropped items is the issue. we don't know *what* entity is triggering this, because the engine logging is terrible. i outlined a few possible causes but i never observed them in my own testing, i had to manually trigger the issue by e.g. using `error()` inside those callbacks.
AliasAlreadyTaken added the
ugh/QA main
label 2023-05-10 14:46:31 +00:00
Author
Owner

After the fix this has never surfaced again. Vote Close as fixed. Other opinions?

After the fix this has never surfaced again. Vote Close as fixed. Other opinions?
flux added
5. result/fixed
and removed
4. step/question
labels 2023-06-30 17:33:13 +00:00
Member

i say we close, we can always re-open or create a new issue if it occurs again.

i say we close, we can always re-open or create a new issue if it occurs again.
flux closed this issue 2023-06-30 17:33:39 +00:00
Member

something possibly related got fixed in the engine recently: https://github.com/minetest/minetest/pull/13635

something possibly related got fixed in the engine recently: https://github.com/minetest/minetest/pull/13635
AliasAlreadyTaken removed this from the Alias@work project 2023-07-21 14:59:11 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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#4306
No description provided.