JDKDigital / productive-bees

Useful bees
https://www.curseforge.com/minecraft/mc-mods/productivebees
Other
64 stars 42 forks source link

Virgin Birth Bees (duping issue) #270

Closed KellyLynch closed 2 years ago

KellyLynch commented 2 years ago

I occasionally have problems with disappearing bees, but today when I logged in, I had hordes of duplicated bees ... over 120, probably (won't have final count until i go through tonight cleaning up the mess).

My setup: each of my bee cells is 2x3x2, with an expanded advanced hive on the 2 wide wall. each had 3 bees, with three different types of bees. I also have some breeding cells, that have no hive available.

In the bee hive ones is where i found all the dupes, so this seems to be tied to the adv. hives.

To give a specific example, I had one cell with one Imperium bee (std) and one Insanium bee (maxxed out stats through dna treats). When I logged in today, I have two Imperium and six! Insanium bees. All the Insanium bees are max statted (Very Productive/Metaturnal/etc).

running on ATM7 0.4.14 (official patreon server), which is currently on productivebees-1.18.2-0.9.0.5

JaisDK commented 2 years ago

Wonderful, do you know if the server had a crash or rollback prior to this?

KellyLynch commented 2 years ago

they did update not long before i noticed. i don't see any crashes (it reboots automatically every 6 hours, and all server starts are related to that)

KellyLynch commented 2 years ago

no rollbacks either.

JaisDK commented 2 years ago

do you have any fire near the hives?

KellyLynch commented 2 years ago

chunk they are in is forceloaded, so does continue to run when i am offline, so i'm never a direct witness to when it occurs, i just see the fallout. no fire anywhere near the hives. closest fire would be ... 40ish? blocks above. (base is all one chunk, so made vertical)

KellyLynch commented 2 years ago

one thing i started to suspect on the disappearing side was due to my cell structure. when exiting a hive with three bees, they'll squish around possibly intersecting or spawning in walls, and will pop in to the adjacent cell. i was starting to wonder if they may suffocate in there, causing the mysterious disappearance issue i was having before. mebbe if they're "in wall" during a server reboot is causing the disappearances &/or duplication? but this one is definitely cloning, given the insanium bee and others... i have a dozen or more rose_gold bees now, even though i only had one in a hive last time i was in (thursday?). Many others, but not all, same situation, from vanilla bees to the highest insanium tiers.

again, no issues with cells that had no hive attached. those all still have the same breeds and number of bees i left them with.

JaisDK commented 2 years ago

without a way to reproduce it, it's really difficult to fix, but I'll run through all the code and see if I can spot any places it might happen

KellyLynch commented 2 years ago

anything i can do on my end to help narrow down possibilities?

JaisDK commented 2 years ago

cross your fingers I don't accidentally delete all bees in the next update :D

KellyLynch commented 2 years ago

rofl... will do. i keep spares in std. cases stashed away for the disappearances... has helped out so far. lol

Legorfyr commented 2 years ago

This is an issue for me too, last update deleted all bees that were outside (luckily only a few nocturnal and metaturnal). Yet if it's just a reboot of the server bees duplicate.

JaisDK commented 2 years ago

@Legorfyr you can reproduce this every time?

There's a new version up, would you be able to check if it stopped with that?

Legorfyr commented 2 years ago

Yep, this happens every time, about a month ago I contacted you about this too, when 80+ hives got wiped out after an update. Since then I'm making it night so almost all bees are inside the hives when the server updates. As soon as ATM7 updates I can let you know if the update works.

JaisDK commented 2 years ago

Do you know if it’s the bees that are outside or the ones inside that are duped?

JaisDK commented 2 years ago

Either way, if it’s any and all server restarts it gives me a place to start looking

Legorfyr commented 2 years ago

The ones outside, some bees tend to not go in a hive (grave bees have a tendency to get stuck behind graves xD) So to give some detailed info: Update = bees outside disappearing Reboot = bees outside duplicating

KellyLynch commented 2 years ago

and with ATM servers rebooting every 6 hours .... lol :D 151 cloned bees for me.. more so, as there were updates i didn't check in after. Soon, I shall take over the universe with my clones ... mwahah-oh... that's been tried before, hasn't it? :D

KellyLynch commented 2 years ago

Legorfyr: One question ... this did not appear to affect my breeding bees, which are in cells that have no hive access. So they're 'outside' on updates/reboots, but they don't disappear or clone. Have you noticed the same on your end? That this seems to affect only bees who have an advanced hive home?

Legorfyr commented 2 years ago

Yeah, if I have a breeding couple out, they don't get deleted, it seems to only affect those that indeed have a home (hive)

Legorfyr commented 2 years ago

Server updated to ATM7 0.4.16 with productivebees-1.18.2-0.9.0.6. All bees outside got wiped again, sadly this time a lot again.

JaisDK commented 2 years ago

Is there a chance the world is loaded up withou PB installed at some point during the update? This would eliminate all bees outside the hive but blocks would come back once the modded was added back in.

JaisDK commented 2 years ago

Did you loose the breeding bees that don’t have hives in the update too?

Legorfyr commented 2 years ago

The way the server is updated: all mods get deleted and the new ones put in, configs are overwritten iirc. I didn't have breeding bees out at the time this happened, so I can't give any info on that. Also, a bit of a weird visual glitch in the hives, checked some, they were empty, yet when it turned day 1 or 2 bees came out anyway.

JaisDK commented 2 years ago

Does this visual glitch persist or do the bees show up in the GUI once they get back to the hive?

Legorfyr commented 2 years ago

Server rebooted and it deleted all the bees outside the hives, nocturnal bees were duplicated and bees in a room for breeding were ok x_X

JaisDK commented 2 years ago

would it be possible to get a log from the server both from before the reboot and the immediate run after?

JaisDK commented 2 years ago

I wonder if the chunks they are in are too data dense to save properly, like filling a chest with written books.

Legorfyr commented 2 years ago

It's weird because it only affected the bees in a 1 chunk radius from where I disconnected.

JaisDK commented 2 years ago

do those chunks have a lot of hives?

JaisDK commented 2 years ago

uploading a new version which strips as much data as possible from the bees before they are saved, if there's a data overload in the chunk this will hopefully resolve it the bees will have to exit and go back in the hive before the data is cleared.

KellyLynch commented 2 years ago

i will add that all of my bees before I parked them were in a one chunk area, roughly 120 bees in hives in that area (spread out vertically).

JaisDK commented 2 years ago

this could be a data issue then, the chunks simply fail to save because of it

hopefully the new version has reduced the data footprint enough, roughly 80% reduction between 0.9.0.6 and 0.9.0.8

Legorfyr commented 2 years ago

So, it happened again in productivebees-1.18.2-0.9.0.9. After a server restart, all bees were duped, except nocturnal ones, a few of those vanished. It's a different set-up now, bees are underground in a 5 x 5 chunk area, 36 hives/layer. It is chunk loaded.

togreglove commented 2 years ago

Just to leave my experiences here. ProductiveBees-1.18.2-0.9.0.9 TNP Limitless 5 Server Have a series of rooms, 3x3x4, went offline, the chunks were all offline loaded. There were a few timed server reboots while I was offline, no info on day/night. Many bee types (lapis, emerald, diamond, etc) all were reduced from 5 bees per room to 1. One or two (redstone) went from 5 to 0. Hives were in the center of the walls, so no corner hives, but they were in the walls, not free standing, only the front exposed. Crowding would only have been an issue at dawn when all 5 bees emerge at once. The next day, I included a BaBee upgrade in my iron bee hive, and when I returned, there were 10 instead of 5. If they died, they were replaced at a higher rate. I tried this with my mystical agriculture bees, which are incapable of being bred, and was able to create many copies of them. My theories to bee death... a) Minecraft vanilla bee bugs b) crowding c) emerging partially in wall/hive and taking half hearts over an extended period of time d) server restart (chunk unload) not recording bee presence properly and deleting them. I have no direct evidence of any of these. As a stopgap measure, when I go offline, I make sure to leave several bees per room with a BaBee upgrade to counteract the deaths and just release the excess bees I get into the world to prevent crowding (cause havoc with the neighbors).
Don't know if any of this helps, it's just my experience with the issues being discusssed here and I hope it does help in some way.

JaisDK commented 2 years ago

Thank you for your input. It seems like chunk loading is a common thing here.

This doesn't happen with vanilla hives. Unlikely to be crowding as 5 bees are not too much for such a relatively big area. It can't be wall damage, as I've made them invulnerable to that due to the janky position in MC. So it must be that the chunk is not saving correctly when force loaded or it's saving the entity states and the block entity states at different times. Do you automatically extract combs from the hives and if so, could you as a test, try to put a hopper under the hives and pull from that hopper instead of directly from the hive? The inventory change of the hopper should mark the chunk for saving and will reveal if the problem is with the hive or the chunk loading.

togreglove commented 2 years ago

My setup has a pipe from the Pipez mod pull from the bottom of the hive and send all output to a common chest for all rooms bees are stored in for further processing. Bottles are inserted remotely via a Modular router. Would you like me to put a hopper and then pipe from the hopper? I'm not sure how marking for chunk saving works 2022-07-28_16 16 49 .

JaisDK commented 2 years ago

Yes, a hopper between the hive and the pipe so the hoppers pulls from the hive and the pipe from the hopper. The hopper should mark it location as changed when the inventory changes in turn marking the chunk as needing saving.

togreglove commented 2 years ago

Will do. Will update tomorrow with results. Will try several variations of bees.

JaisDK commented 2 years ago

I also mark the chunk for saving whenever a bee leaves or enters the hive, but maybe it's not working well so testing with a vanilla thing is best.

togreglove commented 2 years ago

Quick update: Just had a server reboot. Daytime I had 2 hives set up with 5 bees each Upon returning, hive in chunk without hopper had 1 bee, hive with hopper had 4. didn't check to see how many were outside hive at the time, will do that next reset if I'm still up.

togreglove commented 2 years ago

Ok, though I think it doesn't matter, the second test was just bizarre. The hopper bees died out all but 1 (5->1), the non-hopper bees gained 1 (5->6), a superium bee that is non breedable doubled across the hall, an insanium bee died out in another room.

My new theory: There is a chunk save flag for mob entities that is not getting set when the chunk is marked dirty.

If the physical data of the chunk...blocks, tiles, blockstates, tick count, etc. is being marked as dirty and is being saved, but entities are not, then when a chunk saves, the location of the bee is indeterminate. The chunk has info on which bees are in the hive that is saved at a different time than it's info on bees that are out of the hive. Thus, if a bee left the hive and then it saved, we lose a bee, but if a bee entered the hive then it saved, we gain a bee (regardless of breedability).

This is not based on any knowledge of the code base or how saves work, but an intuitive and logical explanation that fits the behavior of the problem and I think is worth investigating. I know my tests don't produce any logical conclusions if we get sync'd saves of world and entities, it's just chaotic randomness.

Edit: Do the bees have a separate markDirty command?

JaisDK commented 2 years ago

Entities do not have a markDirty, they are always saved on the chunk if they are not marked for removal.

It could also be the other way around, that the hives are not saving properly, the logic would just be the other way around. If a bee pops out of the hive and then it's saved, the entity is duplicated. If a bee enters a hive and then saved, the bee is lost.

JaisDK commented 2 years ago

What's strange is that it supposedly does not happen with vanilla beehives. Since it's so consistently a problem in your setup, could you add some test chambers with vanilla beehives?

togreglove commented 2 years ago

I can. I have no clue how vanilla beehives work, but will try to figure it out. As it is now, there's no way I can reliably use bees as a resource because of the risk of a die-out of bees I've worked hours for, but I'd love to help you get this fixed for future packs.

Will let you know how the tests go.

JaisDK commented 2 years ago

I've managed to reproduce it, but only if I shut down the server the wrong way (force quit). It's not the chunk loading in itself that causes issues, but it's more likely to happen for chunk loaded hives because they are always loaded when a server shuts down.

If you have server logs to look at, can you check that the debug.log has something like this in the end after a restart?

[30Jul2022 00:04:26.760] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Stopping server
[30Jul2022 00:04:26.761] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving players
[30Jul2022 00:04:26.762] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving worlds
[30Jul2022 00:04:28.917] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
[30Jul2022 00:04:33.561] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_end
[30Jul2022 00:04:33.565] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_nether
[30Jul2022 00:04:33.568] [Server thread/DEBUG] [net.minecraftforge.common.ForgeHooks/WP]: Gathering id map for writing to world save world
[30Jul2022 00:04:33.575] [Server thread/DEBUG] [net.minecraftforge.common.ForgeHooks/WP]: ID Map collection complete world
[30Jul2022 00:04:33.591] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: ThreadedAnvilChunkStorage (world): All chunks are saved
[30Jul2022 00:04:33.591] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[30Jul2022 00:04:33.592] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[30Jul2022 00:04:33.593] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: ThreadedAnvilChunkStorage: All dimensions are saved
[30Jul2022 00:04:33.931] [Server thread/INFO] [FTB Chunks/]: Shutting down map thread

latest.log should have the same minus a few of the lines

togreglove commented 2 years ago

Alas, I'm on a server that is hosted by a public group, so I don't have access to the debug files.

togreglove commented 2 years ago

Have put in a request for the files, but no response yet. We had a reset with usual random disappearances and dupes. The vanilla hive and oak hive had 3 bees before and 3 bees after, so it's apparently possible to do.

togreglove commented 2 years ago

Don't have log yet, but interested development. The bee nest has now got 6 bees instead of 3. That's vanilla stuff.

JaisDK commented 2 years ago

the server you are playing on keeps shutting down the wrong way then, I would suggest not having the area force loaded

togreglove commented 2 years ago

It won't unload. I have turned off all ways I know of force loading and I come back and all my mana pools are full, all bottles used in hives, etc.

Will talk to admin. Sorry if I messed up your testing with my borked server status/admin