Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-262351

Worldgen deadlock caused by supporting block checks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.20 Pre-release 1
    • 23w18a
    • None
    • Confirmed
    • Collision, Crash, World generation
    • Very Important
    • Expansion A

      In 23w18a there was a bug fix for MC-1133. One of the changes made to make this happen can cause a worldgen deadlock under certain conditions.

      Essentially what's happening is that when an entity is loaded, it often checks for supporting blocks before their bounding box is updated to match the entity's position.
      Since the supporting block check uses this bounding box to determine block collisions, this means that it will require chunks around X=0 and Z=0 to be loaded to perform this check, even if the entity is not actually being loaded there.

      If this for any reason happens during world generation, such as a structure loading in with entities, this will cause a deadlock because the generating chunk is asking to load another chunk, but can itself never finish until that other chunk is loaded.

      This also is not exclusively an issue with servers that disable spawn chunks from loading.
      In vanilla this can be reproduced (although inconsistently) by having this happen during world initialization (preparing spawn area) - before all the spawn chunks have finished loading.

      Reproduction steps:

      • Create a new world with (for ex.) seed 2374522903531219544
      • See how the process gets stuck indefinitely. (This isn't guaranteed to happen every time)

      Update
      I would like to add that this is not only caused by the bounding box not being updated in time. Even when the bounding box is updated before the check, and matches the correct position, this call still seems to be capable of causing a deadlock, but now because requesting chunks for collision checks seems to require the chunk to be fully loaded, which it will never be. I am not 100% sure how chunk loading works so some of this may not be accurate.

            gnembon [Mojang] Gnembon
            Wesley1808 Wesley1808
            Votes:
            9 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: