Productive Bees

Productive Bees

10M Downloads

ConcurrentModificationException on un-synchronized iterator

prefixaut opened this issue ยท 3 comments

commented
  • Minecraft Version: 1.20.1
  • FML: 47.1 / Neoforge 47.1.76
  • PB Version: 1.20.1-12.2.11
  • In combination: FTB Direwolf20, 1.10.0

https://github.com/JDKDigital/productive-bees/blob/dev-1.20.0/src/main/java/cy/jdkdigital/productivebees/common/block/entity/AdvancedBeehiveBlockEntityAbstract.java#L102

In the tickBees helper function, it's getting the inhabitants of the hive, which gives back an unsynchronized iterator.
I'm not really versed in MC Modding, but seems to me that the helper function is being used somewhere in another thread.
In the very least, removing inhabitants seems to cause quite some issues, as this happened on my server quite often now, but always quite randomly, as it's probably a race condition.

Sadly therefore I also can't procide a proper reproducer for this.
If you want/need to, I can send a backup of the world, but I'ld doubt it would help much.

Full Stacktrace:

---- Minecraft Crash Report ----
// I blame Dinnerbone.

Time: 2023-12-27 21:33:17
Description: Ticking block entity

java.util.ConcurrentModificationException: null
        at java.util.ArrayList$Itr.checkForComodification(Unknown Source) ~[?:?] {}
        at java.util.ArrayList$Itr.remove(Unknown Source) ~[?:?] {}
        at cy.jdkdigital.productivebees.common.block.entity.AdvancedBeehiveBlockEntityAbstract.lambda$tickBees$1(AdvancedBeehiveBlockEntityAbstract.java:124) ~[productivebees-1.20.1-12.2.11.jar%23588!/:1.20.1-12.2.11] {re:classloading}
        at net.minecraftforge.common.util.LazyOptional.ifPresent(LazyOptional.java:150) ~[forge-1.20.1-47.1.76-universal.jar%23676!/:?] {re:mixin,re:classloading}
        at cy.jdkdigital.productivebees.common.block.entity.AdvancedBeehiveBlockEntityAbstract.tickBees(AdvancedBeehiveBlockEntityAbstract.java:103) ~[productivebees-1.20.1-12.2.11.jar%23588!/:1.20.1-12.2.11] {re:classloading}
        at cy.jdkdigital.productivebees.common.block.entity.AdvancedBeehiveBlockEntityAbstract.tick(AdvancedBeehiveBlockEntityAbstract.java:85) ~[productivebees-1.20.1-12.2.11.jar%23588!/:1.20.1-12.2.11] {re:classloading}
        at cy.jdkdigital.productivebees.common.block.entity.AdvancedBeehiveBlockEntity.tick(AdvancedBeehiveBlockEntity.java:236) ~[productivebees-1.20.1-12.2.11.jar%23588!/:1.20.1-12.2.11] {re:classloading}
        at net.minecraft.world.level.chunk.LevelChunk$BoundTickingBlockEntity.m_142224_(LevelChunk.java:689) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:mixin,re:classloading,pl:mixin:APP:canary.mixins.json:world.block_entity_ticking.world_border.BoundTickingBlockEntityMixin,pl:mixin:A}
        at net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper.m_142224_(LevelChunk.java:782) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:classloading}
        at net.minecraft.world.level.Level.m_46463_(Level.java:468) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:mffs:setBlockEventHook,xf:fml:twilightforest:cloud,re:computing_frames,pl:accesstransformer:B,xf:fml:mffs:setBlockEventHook,xf:fml:twilightforest:cloud,re:classloading,pl:accesstransformer:B,xf:fml:mffs:setBlockEventHook,xf:fml:twilightforest:cloud,pl:mixin:APP:kubejs-common.mixins.json:LevelMixin,pl:mixin:APP:mixins.hammerlib.json:LevelMixin,pl:mixin:APP:botania_xplat.mixins.json:LevelAccessor,pl:mixin:APP:sliceanddice.mixins.json:LevelMixin,pl:mixin:APP:canary.mixins.json:alloc.chunk_random.LevelMixin,pl:mixin:APP:canary.mixins.json:world.chunk_access.LevelMixin,pl:mixin:APP:canary.mixins.json:world.inline_block_access.LevelMixin,pl:mixin:APP:canary.mixins.json:world.inline_height.LevelMixin,pl:mixin:APP:aether.mixins.json:common.accessor.LevelAccessor,pl:mixin:APP:citadel.mixins.json:LevelMixin,pl:mixin:APP:xycraft_core.mixin.json:LevelRainShieldMixin,pl:mixin:A}
        at net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:351) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:libx:level_load,re:classloading,pl:accesstransformer:B,xf:fml:libx:level_load,pl:mixin:APP:cupboard.mixins.json:ServerAddEntityMixin,pl:mixin:APP:kubejs-common.mixins.json:ServerLevelMixin,pl:mixin:APP:mixins.hammerlib.json:ServerLevelMixin,pl:mixin:APP:modernfix-common.mixins.json:bugfix.chunk_deadlock.ServerLevelMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.cache_strongholds.ServerLevelMixin,pl:mixin:APP:supplementaries-common.mixins.json:ServerLevelMixin,pl:mixin:APP:botania_xplat.mixins.json:ServerLevelMixin,pl:mixin:APP:crafttweaker.mixins.json:common.transform.world.level.MixinServerLevel,pl:mixin:APP:canary.mixins.json:alloc.chunk_random.ServerLevelMixin,pl:mixin:APP:canary.mixins.json:chunk.entity_class_groups.ServerLevelAccessor,pl:mixin:APP:canary.mixins.json:entity.inactive_navigations.ServerLevelMixin,pl:mixin:APP:canary.mixins.json:profiler.ServerLevelMixin,pl:mixin:APP:hyperbox.mixins.json:ServerLevelMixin,pl:mixin:APP:ad_astra-common.mixins.json:ServerLevelMixin,pl:mixin:APP:aether.mixins.json:common.accessor.ServerLevelAccessor,pl:mixin:APP:citadel.mixins.json:ServerLevelMixin,pl:mixin:APP:peripheralworks.mixins.json:ServerLevelMixin,pl:mixin:APP:modulargolems.mixins.json:ServerLevelMixin,pl:mixin:APP:create.mixins.json:accessor.ServerLevelAccessor,pl:mixin:A}
        at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:893) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.dedicated_reload_executor.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:crafttweaker.mixins.json:common.access.server.AccessMinecraftServer,pl:mixin:APP:citadel.mixins.json:MinecraftServerMixin,pl:mixin:A}
        at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:283) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
        at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:814) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.dedicated_reload_executor.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:crafttweaker.mixins.json:common.access.server.AccessMinecraftServer,pl:mixin:APP:citadel.mixins.json:MinecraftServerMixin,pl:mixin:A}
        at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.dedicated_reload_executor.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:crafttweaker.mixins.json:common.access.server.AccessMinecraftServer,pl:mixin:APP:citadel.mixins.json:MinecraftServerMixin,pl:mixin:A}
        at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23671!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.dedicated_reload_executor.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:crafttweaker.mixins.json:common.access.server.AccessMinecraftServer,pl:mixin:APP:citadel.mixins.json:MinecraftServerMixin,pl:mixin:A}
        at java.lang.Thread.run(Unknown Source) ~[?:?] {re:mixin}
-- Block entity being ticked --
Details:
        Name: productivebees:advanced_oak_beehive // cy.jdkdigital.productivebees.common.block.entity.AdvancedBeehiveBlockEntity
        Block: Block{productivebees:advanced_oak_beehive}[expanded=up,facing=west,honey_level=5]
        Block location: World: (216,101,-384), Section: (at 8,5,0 in 13,6,-24; chunk contains blocks 208,-64,-384 to 223,319,-369), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,-64,-512 to 511,319,-1)
        Block: Block{productivebees:advanced_oak_beehive}[expanded=up,facing=west,honey_level=5]
        Block location: World: (216,101,-384), Section: (at 8,5,0 in 13,6,-24; chunk contains blocks 208,-64,-384 to 223,319,-369), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,-64,-512 to 511,319,-1)
commented

do you have a backup mod? that might be trying to serialize the data in parallel.

commented

Yes, there's one automaticallty added in the Modpack and runs ~ every 15min on default.

commented

does the crash happen when the backup runs?