Skip to content

[1.20.1 | Item] Race condition in MixinItem #223

@MeatWheeze

Description

@MeatWheeze

I understand that the 1.20.1 versions are probably no longer worked on, but I'm posting this in case anyone has the same issue.

Users of my mod have infrequently reported a crash where CCA complains of Duplicate factory declarations for [a component type]. I believe this is caused when the server and client threads simultaneously attempt to lazily initialise cardinal_containerFactory:

this.cardinal_containerFactory = StaticItemComponentPlugin.createItemStackContainerFactory((Item) (Object) this);

One thread succeeds first, causing the other to crash due to apparently duplicate factory declarations.

This issue probably only affects singleplayer. I can make it occur more frequently by:"

  • Registering a component for every item,
  • Attempting to retrieve it from the item in the player's main hand on both client and server every tick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions