Remove block entities on server thread - #3564
Conversation
|
Relevant: #3152 |
|
Also #3543 I think |
|
Workaround for log spam: set the |
|
Is it not the case that we need to remove the tiles before we perform the edit? Do ticks occurring mid-edit not have an issue if we've replaced the tile in a chunk section it then attempts to do something with |
Yes, that's what I'm talking about in the Existing Issues section, because Paper has validation checks before block entity ticking, this won't cause unexpected behavior but spam logs like |
Yep I see. w.r.t #3152 this is fixed by putting the sync before the rest of the function - I would still request the same as I did in that PR where we should be chaining the future(s) together (if not already on main thread) similar to how it is handled for if we do/do not yet have the chunk loaded |


Overview
Fix unsafe async block entity removal in Paperweight chunk write adapters.
Description
This PR fixes an issue where PaperweightGetBlocks#internalCall could remove block entities directly while running on FAWE queue worker threads.
Previously, when an edit replaced blocks in a chunk, existing block entities were removed immediately during chunk processing via LevelChunk#removeBlockEntity or the Paper beacon removal path. As the backing
blockEntitiesmap is not designed for concurrent writes, this can cause backing map corruption.Existing Issues
After removing BEs in the final sync tasks, this may spam logs like
Block entity A @ BlockPos state Block{B}[facing=north,type=single,waterlogged=false] invalid for ticking:as the removal happens after the chunk section swap.I am not sure whether the preferred long-term fix is to:
Feedback would be appreciated here, especially around the expected ordering between block entity removal, beacon deactivation events, and the chunk section replacement performed by internalCall.
Submitter Checklist
@since TODO.