Skip to content

Race condition in bordering chunk checks #83

@kylerhenry

Description

@kylerhenry

crash-2025-07-24_16.27.18-server.txt

World generation worker thread (Worker-Main-153) gets stuck in calculation. The thread dump points directly to the Mo' Structures mod as the cause.

The server was trying to find a valid location to place a structure from this mod when it got stuck:

at TRANSFORMER/mostructures@1.5.0+1.21/io.github.frqnny.mostructures.structure.ModStructure.findGenerationPoint(ModStructure.java:77)

canGenerate method in this mod:
https://github.com/frqnny/mostructures/blob/1.21.x/common/src/main/java/io/github/frqnny/mostructures/structure/ModStructure.java#L89-L106

Possibly just takes a long time to generate?

When a worker thread is generating Chunk A, this code asks the chunkGenerator for the final surface height of 24 other nearby chunks.
If one of those nearby chunks (Chunk B) is also being generated by a different worker thread, the first thread (for Chunk A) has to stop and wait for the second thread (for Chunk B) to finish its work. If the thread for Chunk B also needs to check the height of Chunk A for one of its own structures, it will wait for the first thread.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions