Repository navigation
Remove block entities on the main thread to avoid concurrent modifica… - #3714
Open
intersecato wants to merge 1 commit into
Open
intersecato wants to merge 1 commit into
intersecato wants to merge 1 commit into
Conversation
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes #3151
PaperweightGetBlocks#internalCallcopiesnmsChunk.getBlockEntities()into a newHashMapand 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 samebeaconslist.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:v1_21_R1)Submitter Checklist
@since TODO.