Skip to content

Remove block entities on the main thread to avoid concurrent modifica… - #3714

Open
intersecato wants to merge 1 commit into
IntellectualSites:mainfrom
intersecato:main
Open

intersecato wants to merge 1 commit into
IntellectualSites:mainfrom
intersecato:main

Conversation

@intersecato

@intersecato intersecato commented Nov 3, 2026 •

Copy link
Copy Markdown

Overview

Fixes #3151

PaperweightGetBlocks#internalCall copies nmsChunk.getBlockEntities() into a new HashMap and then removes block entities from the chunk while running off the main thread. If the server modifies the same map at the same time (e.g. block entities being added/removed by ticking or chunk loading), the copy can fail with:

java.lang.NullPointerException: Cannot read field "wrapped" because "this.wrapped" is null at PaperweightGetBlocks.internalCall(PaperweightGetBlocks.java:349)

Description

The copy of the block entity map and the removal of the existing tiles (including the beacon deactivation handling) now run inside TaskManager.taskManager().sync(...), which returns the list of removed beacons. Everything after this block is unchanged, so the later beacon handling still uses the same beacons list.

This follows the approach of #3152, which only covered the 1.20.2–1.21.4 adapters. This PR applies it to every adapter currently on main:

  • 1.21 (v1_21_R1)
  • 1.21.4
  • 1.21.5
  • 1.21.6
  • 1.21.9
  • 1.21.11
  • 26.1
  • 26.2
  • 26.3

Submitter Checklist

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO.
  • I read and followed the contribution guidelines.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 15:16
@intersecato
intersecato requested a review from a team as a code owner November 3, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server-Crash on FAWE-Operation while affected Blocks are getting ticked

2 participants