Time Nick Message 03:55 Blockhead256 !tell gera In my experience, it's a choice between Moiré effect or highly visible mipmap boundaries. Sorry! 03:55 MinetestBot Blockhead256: I'll pass that on when gera is around 14:59 MinetestBot 02[git] 04sfan5 -> 03minetest/minetest: Call malloc_trim() regularly to improve deallocation behavior (#14707) 137189380 https://github.com/minetest/minetest/commit/71893807b37c07bd428d71c47fd7cbd12bc82760 (152024-06-07T14:57:30Z) 20:22 shaft Krock, you asleep? 20:23 Krock yes 20:23 Krock thank you for asking 20:23 shaft I think you forgot about my mesecons pr. Doesn't have to be now but it would be nice if I'm one step further on my texturepack roadmap. 21:00 shaft I'll just remind you again tomorrow 21:01 ROllerozxa sleeptalking over IRC 23:03 BluebirdGrey51 I'm trying to set player meta [pref:get_meta():set_string("key", "stuff,etc") for example] inside "on_shutdown" and "on_leaveplayer" callbacks, and I've noticed that in singleplayer this does NOT work. The data are not remembered after next restart. Is this a known bug? 23:04 BluebirdGrey51 This is causing me a problem because I need to set some info on a player when they leave the game, but this seems to work only if the server is running in multiplayer mode, and DOESN'T shutdown at the same time the player leaves. 23:10 BluebirdGrey51 Did a test just now, using Minetest fetched from git just a couple days ago. I can confirm this is absolutely the case: if a multiplayer-mode server shuts down while players are connected, any data set on those players will NOT be saved, either in 'on_leaveplayer' or 'on_shutdown'. 23:11 BluebirdGrey51 I suspect trying to save the player-specific data in mod storage (rather than player meta) will have the same problem. It seems the server does not persist changes to meta that are made a such a late date. 23:11 MTDiscord BluebirdGrey51: your observation is probably right, but i don't think your explanation is 23:12 MTDiscord IIRC in singleplayer on_leaveplayer and/or on_shutdown just don't get run 23:12 Mantar on_leaveplayer is not run in singleplayer, or in hosted for the first connected player 23:12 Mantar it's weird 23:12 MTDiscord Why not eagerly update the data may I ask? Updating in on_shutdown is error prone in general, for example if the server crashes. 23:12 BluebirdGrey51 That's probably true, but I tested just now in "multiplayer mode". I hosted a server, joined a test player, and shutdown the server while the player was still connected. The data that was supposed to be there, isn't. 23:13 BluebirdGrey51 So it's not just a singleplayer bug. 23:13 BluebirdGrey51 I could update the data every single time something changes. 23:13 BluebirdGrey51 But this particular data would be changing A LOT, in that case. 23:14 BluebirdGrey51 I wanted to do a lazy update and save some cycles. 23:14 BluebirdGrey51 I'm ok with not having the data after an occasional crash (I hardly ever crash) 23:14 MTDiscord Update the data eagerly unless you can demonstrate that this is a performance issue. 23:15 MTDiscord Minetest only persists the data lazily behind the scenes anyways (map save interval IIRC). 23:15 Mantar frequent meta accesses can cause lag, so if you're gonna be doing a lot of it, maybe cache it and only save every second or two 23:16 MTDiscord Anyways, since you say this extends beyond singleplayer: Can you produce a minimal reproducible example? 23:16 * Mantar found the issue with Exile's hud way back was that it was doing ~35 meta accesses, per player, per tick, which caused the hud to lag badly in MP 23:17 MTDiscord If you really reduce your mod to "save something in meta in on_leaveplayer / on_shutdown", does that demonstrably not persist the data? 23:17 BluebirdGrey51 A whole mod, or will just a snippet do? 23:17 MTDiscord a snippet will do 23:17 MTDiscord a mod is basically just a snippet in init.lua + mod.conf ;) 23:17 MTDiscord but as said the crucial part is that it is minimal 23:18 MTDiscord it is not unlikely that you have a mistake in your logic. with a minimal reproducible example, that can't happen, or if it does, it's hopefully obvious to me if i look at it. 23:19 BluebirdGrey51 minetest.register_on_shutdown(function() 23:19 BluebirdGrey51 local players = minetest.get_connected_players() 23:19 BluebirdGrey51 for k, v in ipairs(players) do 23:19 BluebirdGrey51 local meta = v:get_meta() 23:19 BluebirdGrey51 meta:set_string("fancy_long_key", "superduper value") 23:19 BluebirdGrey51 print("Data that should be here after restart: " .. meta:get_string("fancy_long_key")) 23:19 MTDiscord i could imagine that on_leaveplayer / register_on_shutdown execute too late, that is, player meta access only works when the player is still online. naturally, on leave, or on shutdown run pretty late, so if the player was in a half-deinitialized state, i could imagine that they might fail. so a bug here does sound plausible. 23:19 BluebirdGrey51 Ok, so 9 lines is too much to paste. 23:20 MTDiscord best to use a pastebin service of your choice ;) 23:20 BluebirdGrey51 https://gist.github.com/BluebirdGreycoat/8c7751410e93cd6b75ccfce5535c2d18 23:21 MTDiscord alright thanks for the report, i'll take a look 23:24 MTDiscord BluebirdGrey51: btw which version are you on? 5.9-dev? 23:24 MTDiscord (i just tested with 5.8.0 and that worked fine) 23:25 BluebirdGrey51 5.9.0-dev-87232358d 23:26 BluebirdGrey51 I'm trying to test with that snippet right now and for some reason I'm not seeing the print message at all. Sigh. Still working on it ... 23:26 MTDiscord i'm not seeing the print message either 23:26 MTDiscord this does look like a regression. the message appears on 5.8.0 in singleplayer. 23:27 MTDiscord i would guess get_connected_players returns the empty list on shutdown, which it shouldn't. 23:28 MTDiscord indeed it does. 23:28 BluebirdGrey51 yes, it says 0 players on shutdown --- seems my test player is leaving before the shutdown happens. i'm going to modify my test code and send a new gist in a few mins. 23:29 MTDiscord would you like to file a bug report? otherwise i can do it for you. 23:30 MTDiscord this looks like a pretty clear regression to me: in 5.8.0, get_connected_players returns a list of connected players in on_shutdown. in 5.9-dev, this list is empty. note that on_leaveplayer isn't called either for shutdowns. so mods would have no way to deal with this if we don't fix it. 23:34 BluebirdGrey51 Here's the new gist: https://gist.github.com/BluebirdGreycoat/4764c1d927e2ce9a2770293cef65e4e5 23:36 MTDiscord the meta part is irrelevant if the list of players iterated on shutdown is empty 23:36 MTDiscord minetest.register_on_shutdown(function() print("#players", #minetest.get_connected_players()) end) basically suffices to demonstrate the regression 23:37 BluebirdGrey51 I'll leave the bug report for you if you don't mind. You know more about it, I only know it isn't working 23:38 MTDiscord okay sure 23:38 BluebirdGrey51 thanks much! 23:44 MTDiscord https://github.com/minetest/minetest/issues/14736